Building Maven is a little different than your typical Java
build because Maven uses itself to build itself! Thus, in order
to successfully build Maven, a bootstrapping process is required
to jumpstart the build. Fortunately, the details of this have
been encapsulated in a separate build file called
build-bootstrap.xml
. This document details the
necessary steps to successfully build Maven from source. After
completing the process, not only will Maven be built, it will
also be installed on your system, which will enable you to build
any other Maven-enabled project (i.e. all Turbine projects).
Before you can build Maven, you'll need to make sure you have Ant 1.5 or higher
installed on your system. Don't forget to install the
optional.jar
included with Ant. In addition,
you'll also need the JUnit
unit testing framework installed. Be sure to install
junit.jar
in your ANT_HOME/lib
directory. Failure to do so will result in build errors.
You also must have the MAVEN_HOME
env-var set. The
Maven installation is encapsulated in the directory specified by
MAVEN_HOME
: scripts, Maven's run-time library, plug-ins and the
local repository. MAVEN_HOME
must not end with a path delimiter -
ie. /
or \
Note: as the installation of Maven is automatic and part of the build process, make sure you really want to overwrite the files you may have in that location.
For the impatient reader that doesn't want to read the rest of this document, type the following:
All development efforts are now in producing the final 1.0 release. This means the most active (and stable) branch is MAVEN-1_0-BRANCH (in the maven project) and HEAD on maven-plugins.
If you are new to Maven, it is recommended that you read the rest of the document as it explains the build process in a little more detail.
If you are behind a proxy, you must define proxy parameters for building Maven : FAQS.
Before you can begin the process, you'll need to download the
source from the maven
and maven-plugins
CVS repository. If you are not familiar with the CVS
repositories, please see the documentation.
After setting the value of MAVEN_HOME
and
pulling down the sources you are now ready to
build and install Maven on your system using the bootstrapping
process. As mentioned earlier, the bootstrapping process is
defined in build-bootstrap.xml
, and can be
initiated by typing the following:
Thats it! Congratulations! You have now built Maven with Maven and installed Maven on your system!
If you get an OutofMemoryError during bootstrap, try setting an environment variable MAVEN_OPTS to provide more memory, e.g. on Windows
set MAVEN_OPTS=-Xmx512m
Now you're ready to go
MAVEN_HOME
.
The source for the plugins can be found in the maven-plugins cvs repository. See the documentation for more information on accessing that repository.
Once you've downloaded the source, you can easily install all the plugins in a single command. See the FAQ for more detail on how to install them once downloaded.
This section explains how to build Maven with an already installed Maven binary.
This assumes that you have both the maven
and maven-plugins
CVS trees checked out, as above.
Start by running maven -u
in the maven
CVS tree's base directory.
This will give you a quick overview of the defined goals.
Note: some of the goals are named in the form of plugins-x. These goals have some common logic: they invoke the reactor on the plugins directory and use the properties maven.plugins.include and maven.plugins.exclude.
Goal | Description |
---|---|
maven:jar-install | Compile Maven and put a new jar in ${maven.home}/lib. This goal attains the jar:jar goal, and copies then the jar to the lib in maven home, as well as to the local repository. |
maven:build-install | Builds a full, clean maven installation in the target/installer directory. |
maven:installer | Builds and creates tar.gz, bzip, zip and exe (if NSIS is installed) which are suitable for binary installations, similar to the binaries that can be download from the maven site. |
maven:plugins-build | Build each Maven plugin into an installable jar. This goal runs the clean and plugin target on the maven plugins dir. the included and excluded plugins are contolled by the maven.plugins.include and maven.plugins.excludes properties respectively. |
maven:plugins-clean | Cleans all plugin projects. Runs the clean goal on the included plugins. |
maven:plugins-install | Install each Maven plugin. This goal runs the clean and plugin:install goal in each included plugin. |
maven:plugins-test | Test each Maven plugin. Runs the plugin:test goal on each included plugin. |
maven:run-touchstone | Calls maven with the project file in ${basedir}/src/test/touchstone-build/project.xml and the clean, jar:jar and touchstone-tests goals. |