Configure Maven build

CollabNet provides you with a Maven deploy plugin that has all the functionalities of the default Maven deploy plugin. Additionally, it posts binary artifact creation event information on to TeamForge Orchestrate enabling end-to-end traceability.

To configure your Maven build:
  1. Replace the standard deploy with CollabNet's plugin in your POM.xml.
    <pluginRepositories>
      <pluginRepository>
        <id>collabnet</id>
        <name>Collabnet Public Repo</name>
        <url>http://mvn.collab.net/nexus/content/groups/public/</url>
      </pluginRepository>
    </pluginRepositories>
    <plugins>
      ....
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
          <configuration>
            <skip>true</skip>
          </configuration>
        </plugin>
        <plugin>
          <groupId>net.collab.maven.deploy</groupId>
          <artifactId>collabnet-deploy-maven-plugin</artifactId>
          <version>1.4.1</version>
          <extensions>true</extensions>
          <executions>
            <execution>
              <id>default-deploy</id>
              <phase>deploy</phase>
              <goals>
                <goal>deploy</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <amqpServer>amqp://host.with.amqp</amqpServer>
            <sourceAssociationKey>as-per-orchestrate-setup</sourceAssociationKey>
            <associatedBuildNumber>${env.BUILD_NUMBER}</associatedBuildNumber>
          </configuration>
        </plugin>
      </plugins>
    
  2. Setup the Nexus and Orchestrate credentials in settings.xml. You may find this file in the Maven home directory. For example, in the following illustration, your distribution management section has a repository id of the local-nexus and the amqpServer, amqp://host.with.amqp is setup as mentioned in Step 1:
    <settings>
     <servers>
      <server>
       <id>local-nexus</id>
       <username>your_ctf_username</username>
       <password>xxxxxxxx</password>
      </server>
      <server>
       <id>amqp://host.with.amqp</id>
       <username>myproj_nexus</username>
       <password>xxxxx</password>
      </server>
     </servers>
    </settings>

    If you already have a set of credentials against an AMQP URL in settings.xml, all jobs including the one that posts events against different sources can use the same credentials.

    Table 1. All available configuration items:
    Configuration parameter Description Mandatory Default value Example
    amqpServer An amqp url for the form amqp://host.domain where Orchestrate is listening to. True None amqp://example.com
    sourceAssociationKey The source association key from orchestrate custom event setup. True None uuid format
    orchestrateSchemaId The schema id posted to Orchestrate. Do not set it in v1.4.1 and later. True binary_artifact binary_artifact
    orchestrateSchemaVersion The version of the schema, usually 1. Omit to default to 1. Do not set it in v1.4.1 and later. False 1 1
    amqpUserName The AMQP user name. It is recommended not to set it in the project POM but using in settings.xml. Take it from the custom event setup in Orchestrate. False None proj_custom
    amqpPassword The AMQP password. It is recommended not to set it in the project POM but using in settings.xml. Take it from the Orchestrate settings. False None af78aaee0c5610d21....
    amqpQueueName Do not specify. Defaults to orchestrate.custom. False orchestrate.custom orchestrate.custom
    associatedBuildNumber Specify to the env variable depending on your build system process. Set to ${env.BUILD_NUMBER} for jenkins and teamcity. False None ${env.BUILD_NUMBER}
    skipOrchestrateNotification Set to true to disable notification. False False False
    dieOnOrchestrateError Defaults to true. Set to false to treat orchestrate notification errors as non-fatal. False True True