Building Maven

Why would I want to build Maven?

Building Maven yourself is for one of two reasons:

  • to try out a bleeding edge feature or bugfix (issues can be found in JIRA),
  • to fix a problem you are having and submit a patch to the developers team.

Note, that you don't need to bootstrap Maven for day to day use, or to develop plugins. While we encourage getting involved and fixing bugs that you find, for day to day use we recommend using the latest release.

Checking out the sources

All of the source code for Maven and its related libraries is in managed in the ASF source code repositories. Current development of the core of Maven, and some other components, are in git. Other pieces (and older versions) are in Subversion. For details, see http://maven.apache.org/source-repository.html.

Building Maven

Building a Maven Plugin or Component

Building a Maven plugin or component is like any Maven build:

mvn install

Before submitting a patch, it is advised to run the integration tests, which are available in a profile:

mvn -Prun-its install

Building Maven With Maven Installed

If you already have Maven installed, it can be faster to build a new version with Maven, rather than a clean bootstrap.

To do this, run from the source directory:

mvn install

The assemblies will be created in maven-distribution, and can be unzipped to the location where you'd like Maven installed.

Building Maven Without Maven Installed

If you do not have Maven installed, you can use Apache Ant to build Maven.

Once you have checked out the code, change into the directory that was created.

Set the M2_HOME environment variable to the location that should contain Maven. This directory must be named after the Maven version you want to build and install, for example /usr/local/maven-3.2.x-SNAPSHOT.

export M2_HOME=/usr/local/maven-3.2.x-SNAPSHOT
PATH=$M2_HOME/bin:$PATH

or

set M2_HOME=c:\maven-3.2.x-SNAPSHOT
set PATH=%M2_HOME%\bin;%PATH%

From this, run the ant command:

ant

This will download dependencies, build Maven, and install it into the directory you specified as M2_HOME above.

Running the full Maven core integration tests

Before checking in a change or submitting a patch to Maven core, it is required to run the integration tests. These live in their own git repository. Using your local build of Maven, run:

mvn install -Prun-its

Consult Core IT Suite documentation for more options.