View Source

{excerpt-include:Build Configuration|nopanel=true} To learn more about build configurations in TeamCity, refer to the [Build Configuration] page.
TeamCity provides several ways to create new build configuration for a project. You can:
* [Create new build configuration from scratch|#creatingNewBuildConfiguration].
* [Create build configuration template|#creatingBuildConfigurationTemplate], and then [create build configuration based on the template|#creatingBuildConfigurationFromTemplate].
* [Create Maven build configuration|#mavenConfiguration] by importing settings from {{pom.xml}}

{anchor:creatingNewBuildConfiguration}
h2. Creating New Build Configuration
# On the *Administration* page, locate the desired project in the list and click *Create build configuration* link which is available right after the list of project's configurations. Alternatively, you can find this link on the project settings page.
# Specify [General Settings|Configuring General Settings] for the build configuration, then click the *VCS settings* button.
# [Create/edit VCS roots and specify VCS-specific settings|Configuring VCS Settings], then click the *Add Build Step* button.
# On the *New Build Step* page, configure first build step - select the desired build runner from the drop-down list, and [define its settings|Configuring Build Steps]. Click Save.
You can add as many build steps as you need within one build configuration. Note, that they will be executed sequentially. In the end, the build gets merged status and the output goes into the same build log. If some step fails, the rest are not executed.
# Additionally, configure [build triggering options|Configuring Build Triggers], [dependencies|Configuring Dependencies], [properties and variables|Configuring Build Parameters] and [agent requirements|Configuring Agent Requirements].

----
{anchor:creatingBuildConfigurationTemplate}
h2. Creating Build Configuration Template
To learn more about build configuration templates, refer to the [Build Configuration Template] page.
Creating a build configuration template is similar to creating a new configuration. On the Project settings page click the *Create template* link and proceed with configuring [general settings|Configuring General Settings], [VCS settings|Configuring VCS Settings] and [build steps|Configuring Build Steps].

----
{anchor:creatingBuildConfigurationFromTemplate}
h2. Creating Build Configuration From Template
To create a build configuration based on the template, on the Project settings page locate the desired template and click *Edit*. Then, click the *Create Build Configuration From Template* button and specify the name for new configuration. The settings set up in the template cannot be edited in a configuration created from this template. If you want to change them, modify them in the template's settings. However, note that this will affect all configurations based on this template.

----
{anchor:mavenConfiguration}
h2. Creating Maven Build Configuration
To create new build configuration automatically from the {{POM.xml}} file, on the Project settings page click the *Create Maven build configuration* link and specify the following options:
|| Option || Description ||
| POM file | Specify the POM file to load configuration data from. You can either provide an URL to the {{pom.xml}} file in a repository or upload {{pom.xml}} file from your local working PC. The URL to the POM file should specified in the [#Maven SCM URL format]. |
| Username | Username to access the VCS repository. |
| Password | Password to access the VCS repository. |
| Goals | Provide goals for the Maven build runner to be executed with the new configuration. |
| Triggering | Select the check box to set automatic build triggering on snapshot dependency. |
{info}From the provided POM file TeamCity reads the name and the VCS root URL parameters for the new build configuration. For non-Maven projects, if there's no VCS root URL provided in the {{pom.xml}}, then the process will be aborted with error.{info}

When the new Maven configuration is created, any further configuring is similar to editing an ordinary build configuration.

Refer to Maven documentation on the SCM Implementation for the following supported version control systems:
* Subversion: [http://maven.apache.org/scm/subversion.html]
* Perforce: [http://maven.apache.org/scm/perforce.html]
* StarTeam: [http://maven.apache.org/scm/starteam.html]

{anchor:MavenSCMURLformat}
h3. Maven SCM URL Format

The general format for a SCM Url is
{code}
scm:<scm_provider><delimiter><provider_specific_part>
{code}
As delimiter you can use either colon ':' or, if you use a colon for one of the variables (for example, a windows path), you can use a pipe '\|'.

For more information, please refer to the [official Maven SCM documentation page|http://maven.apache.org/scm/scms-overview.html].

In TeamCity you can use simplified SCM URL format:
* If the protocol defined in the provider-specific part unambiguously identifies the SCM-provider, then the {{scm:<scm_provider>:}} prefix of the URL can be omitted. For instance, the "{{scm:starteam:starteam://host.com/trunk/pom.xml}}" URL will valid in the "{{starteam://host.com/trunk/pom.xml}}" format. In any other case, for example if HTTP protocol is used for SVN repository, then the SCM-provider must be specified explicitly:
{noformat:nopanel=true}
svn:http://svn.host.com/trunk/project/pom.xml
{noformat}
* The {{scm}} prefix can be omitted, or can be replaced with {{vcs}} prefix.

h4. Examples of the SCM URL for Supported SCM Providers

The following URLs will be considered as equal:

* Subversion:
{code}
scm:svn:svn://svn.company.com/project/trunk/pom.xml
or
vcs:svn:svn://svn.company.com/project/trunk/pom.xml
or
svn:svn://svn.company.com/project/trunk/pom.xml
or
svn://svn.company.com/project/trunk/pom.xml
{code}
{note:title=Note}Please note that "{{svn:http://svn.company.com/project/trunk/pom.xml}}" URL does not equal to the
"{{http://svn.company.com/project/trunk/pom.xml}}".
{note}
* StarTeam:
{code}
scm:starteam:starteam://host.com/project/view/pom.xml
or
starteam:starteam://host.com/project/view/pom.xml
or
starteam://host.com/project/view/pom.xml
{code}
* Perforce:
{code}
scm:perforce:user@//main/myproject/pom.xml
or
perforce:user@//main/myproject/pom.xml
{code}


\\
\\
{color:#003366}*See also:*{color}
{panel:borderStyle=dashed|bgColor=#FFFFFF}
*Administrator's Guide*: [Configuring Dependencies] | [Configuring Build Parameters] | [Configuring VCS Settings]
{panel}