The following assumes basic familiarity with use of source repository and command-line build systems.
Maven is a network-based build management system. We assume the binary distribution has been installed (version 3.6.0 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.
To activate the use of the settings.xml provided:
mvn -s settings.xml clean installThe settings.xml defines the repositories for all the required dependencies that are not found in Maven Central. Typically, you need to invoke the -s settings.xml only once to cache the dependencies. Also, if you are running in a corporate environment, you may be using a Maven Repository Manager, such as Nexus, which may proxy the repositories behind a public open-source group.
One of Maven's most useful features are profiles.
JBehave's profiles are:
Note that profiles are additive and the default profile is always active.
Some examples:
mvn clean install -Pexamples (build core and runs examples, excluding GUI-based ones) mvn clean install -Pexamples,gui (build core and runs 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.
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.
Maven is supported in most modern IDEs - e.g. Intellij IDEA or Eclipse. It builds the project classpath based on the dependencies declared in the POMs.