Working with Maven

Check out code from CVS, and build them with Maven. Instruct Maven to use version managed by QuickBuild, and make artifacts published to Maven repository also accessible from QuickBuild's web interface.

  1. Trigger configuration root.live-samples.usecase2 with force build option. QuickBuild should check out code from CVS repository, trigger the maven builder. Upon the build, Maven will try to create a local repository at D:\maven-repository. This directory is specified in file <checkouts dir>/sample2/project.properties, where <checkouts dir> is the directory used to hold checked out code from CVS. Of course, you can change local repository to any other directory if you like, but please do not check them into QuickBuild's demo CVS, in order not to disturb other persons using this live sample.

    [Note]Note

    Do not forget to set property path to maven executable in basic settings of the root.live-samples configuration.

  2. You now have successfully gotten the build running with Maven integration. On build detail page, you should see several files are listed there as published artifacts. Please note that these files are actually located in Maven's local repository. They appear here because soft links to them are created under artifacts directory of current build. This was done by the step of type publish (see steps tab of this configuration). In this step, we specify D:\maven-repository\maven-sample\jars as source directory for publishing, and specify maven-sample-${build.version}.* as the file name pattern. Before this publish step runs, OGNL expression in this pattern will be replaced with current build's version, for example, 1.0.3, and the publishing file name pattern will actually be maven-sample-1.0.3.*, which means all files under the source directory with file name starting with maven-sample-1.0.3 will be published into artifacts directory of current build, that is, soft links to these files have been created under artifacts directory.

  3. Also Maven is using version number managed by QuickBuild as current version. This is done in two steps:

    • When define Maven builder, pass in a property named by buildVersion (You can choose other name of course), and set its value to be "${build.version}". Here quotes are used in case that evaluated OGNL expression contains white spaces.

    • In the project definition file (<checkouts dir>/sample2/project.xml here), instruct Maven to use value of passed in buildVersion property as current version:

      <currentVersion>${buildVersion}</currentVersion>