Maven
Note that you can create a new Maven-based build configuration Creating and Editing Build Configurations, and set up a Configuring Maven Triggers, if a specific Maven artifact has changed.
Below you can find reference information about the Maven2 Build Runner fields:
Maven Parameters
Option | Description |
---|---|
In the Goals field, specify the sequence of space-separated Maven goals that you want TeamCity to execute. Some Maven goals can use version control systems, and, thus, they may become incompatible with some Configuring VCS Settings. If you want TeamCity to execute such a goal:
| |
Specify the path to the POM file relative to the Build Working Directory. By default, the property contains a | |
Additional Maven command line parameters | Specify the list of command line parameters. |
Working directory | Specify the Build working directory, if it differs from the Build Checkout Directory. |
Maven Home
In Maven selection field, choose the Maven version you want to use. By default, the path to Maven installation is taken from the M2_HOME environment variable, otherwise the bundled Maven 3 is used. Alternatively, you can set it as %\MAVEN_HOME%
environment variable right on a build agent.
User Settings
Specify what kind of user settings to use here. This is equivalent to the Maven command line option -s or --settings. The available options are:
<Default> | Settings are taken from the default Maven locations on the agent. For the server logic, see Maven Server-Side Settings. |
---|---|
<Custom> | Enter the path to an alternative user settings file. The path should be valid on agent and also on the server, see Maven Server-Side Settings. |
Predefined settings | If there are settings files uploaded to the TeamCity server via the administration UI, you can select one of the available options here. To upload settings file to TeamCity, click Manage settings files. You can upload Maven user settings files at any time using the Administration| Integrations | Maven Settings page. The uploaded files are stored under |
If Custom or Predefined settings are used, the path to the effective user settings file is available inside the maven process as the teamcity.maven.userSettings.path
system property.
Java Parameters
The path to JDK Home is read from the *JAVA_HOME* environment variable or *JDK home* specified on the build agent if you leave this field empty. If these two values are not specified, TeamCity uses the JDK home on which the build agent process is started. | |
---|---|
Specify JVM command line parameters; for example, maximum heap size or parameters enabling remote debugging. These values are passed by the JVM used to run your build. For example: |
Local Artifact Repository Settings
Select Use own local repository for this build configuration to isolate this build configuration's artifacts repository from other local repositories.
Incremental Building
Select the Build only modules affected by changes check box to enable incremental building of Maven modules. The general idea is that if you have a number of modules interconnected by dependencies, a change most probably affects (directly or transitively) only some of them; so if we build only the affected modules and take the result of building the rest of the modules from the previous build, we will get the overall result equal to the result of building the whole project from scratch with less effort and time.
Since Maven itself has very limited support for incremental builds, TeamCity uses its own change impact analysis algorithm for determining the set of affected modules and uses a special preliminary phase for making dependencies of the affected modules.
First TeamCity performs own change impact analysis taking into account parent relationship and different dependency scopes and determines affected modules. Then the build is split into two sequential Maven executions.
The first Maven execution called preparation phase is intended for building the dependencies of the affected modules. The preparation phase is to assure there will be no compiler or other errors during the second execution caused by the absence or inconsistency of dependency classes.
The second Maven execution called main phase executes the main goal (for example, test
), thus performing only those tests affected by the change.
Also check a related blog post on the topic.
Code Coverage
Coverage support based on IDEA coverage engine is added to Maven runner. To learn about configuring code coverage options, please refer to the Configuring Java Code Coverage page.