Configure Maven build

CollabNet provides you with a Maven deploy plugin that completely inherits the default (vanilla) Maven deploy plugin. Additionally, it posts binary artifact creation event information on to TeamForge EventQ 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>8.2</version>
          <extensions>true</extensions>
          <executions>
            <execution>
              <id>default-deploy</id>
              <phase>deploy</phase>
              <goals>
                <goal>deploy</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <skipLinkToBinaries>true</skipLinkToBinaries>
            <amqpServer>amqp://host.with.amqp</amqpServer>
            <sourceAssociationKey>as-per-orchestrate-setup</sourceAssociationKey>
            <associatedBuildNumber>${env.BUILD_NUMBER}</associatedBuildNumber>
          </configuration>
        </plugin>
      </plugins>
    
    Important: Make sure the <skip> tag is set to true to prevent more than one Nexus/Artifactory notification for a single Nexus/Artifactory artifact deployment. If <skip> is not set to true, notifications are sent by both the maven-deploy-plugin and the collabnet-deploy-maven-plugin for a single binary artifact.
  2. Setup the Nexus/Artifactory and EventQ 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 EventQ 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 EventQ. 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 EventQ. 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 EventQ 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. 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
    component Used to identify a specific binary artifact as a component in a larger application. False none An ALM platform has several components such as an application server, an indexer, an SCM integration server and so on. These components have their own build process. This property is used to uniquely identify such components in EventQ.
    componentOf Associated with the 'component' parameter to store the details of the component. False none SCM as a component of Teamforge.