Overview

The following assumes basic familiarity with use of source repository and command-line build systems.

Building with Maven

Maven is a network-based build management system. We assume the binary distribution has been installed (version 2.2.x or above) and that the executable mvn is in the system path.

People new to Maven may find useful to download a PDF version of the website documentation. There is also extensive free documentation available from the Sonatype Maven Books.

Maven build profiles

One of Maven's most useful features are profiles.

JBehave's profiles are:

  • default: builds all releasable modules
  • examples: builds examples
  • gui: builds examples that require non-headless mode (separated as they do not run on CI)
  • reporting: builds reports
  • distribution: builds distribution

Note that profiles are additive and the default profile is always active.

Some examples:

mvn clean install -Pexamples (build core and all examples, excluding GUI-based ones)
mvn clean install -Pexamples,gui (build core and all examples, including GUI-based ones)
mvn clean install -Preporting,distribution (build with reporting and distribution)

Note that the Maven build phase install is used as it automatically implies all other previous phases in the module build cycle, in particular the test or integration-test phases, where appropriate.

Performing a release

Using Maven's release plugin makes the release process very easy:

mvn release:prepare -Preporting,distribution 
mvn release:perform -Preporting,distribution

It is a two-step process as the first step (release:prepare) creates a tag in source control replacing all snapshot versions with a fixed version, while the second step (release:perform) builds the release from the tag and performs the upload to the remote repository.

Integration with IDEs

Maven is supported in most modern IDEs - e.g. Intellij IDEA or Eclipse (via the m2eclipse plugin). It builds the project classpath based on the dependencies declared in the POMs.