Skip to main content
Version: QB80

Build with Maven

QuickBuild is able to integrate with the popular build tool - Maven. A Maven build step can be added by selecting menu item Build -> Maven from the step menu.

Configure Maven command location

QuickBuild calls the command mvn to run Maven build. If this command is not in system path, you will need to specify its location in plugin setting of the Maven plugin through Plugin Management page.

Further more, mvn command location can be specified on a per-node basis by following below steps:

  1. Open Maven plugin setting page and set the property Maven Executable Path as:

    ${node.getAttribute("mvnPath")}
  2. For each node that does not have command mvn on system path, [define the user attribute](Working with Build Grid.html#WorkingwithBuildGrid-defineuserattributes) mvnPath to point to the actual mvn command path, for example:

    mvnPath=/home/robin/bin/mvn

    In case of user agent node, the user attribute need to be defined [in this way](Manage User Agent.html#ManageUserAgent-defineuserattributes).

Please note that in above example, the mvnPath user attribute is just for demonstration purpose. You can use any other user attribute name.

Control build version

  1. If you want to control the build version from QuickBuild side, please follow below steps:

    1. Change the POM file and define the project version as ${buildVersion}. Do not forget to commit the file into your SCM after change.

    2. Define a build property like below when define the Maven build step:

      buildVersion=${build.version}
  2. You can also instruct QuickBuild to use version in POM file as build version by checking the Sync Build Version option when define the maven build step (since 5.0.8).

Trigger dependent projects

When a snapshot version of a library is built, QuickBuild can be configured to do verificatin build of all projects using this snapshot library. This can be done by checking the option Trigger Dependents in general setting of the library configuration. Also please make sure that the option Resolve Effective POM in maven plugin setting (can be found in page Administration/Plugin Management) has been enabled.

warning

Newly added maven configurations have to be triggered at least once (either manually or scheduled) before this works, as QuickBuild has to set up the dependency graph first at the time of running Maven build. Also the configuration has to be built once if dependency information is changed in its POM to update the dependency graph. Normally this will not be a problem if you set up the configuration to build automatically upon repository modification with a schedule.