Building Maven is a little different than your typical Java build because Maven uses itself to build itself! So, in order to successfully build Maven from scratch, a bootstrapping process is required to jumpstart the build. Alternatively, if you already have Maven installed and would just like to build a newer version, you can follow these instructions.
Before you can build Maven, you'll need to make sure you have Ant 1.5 or higher installed on your system.
You also must have the
MAVEN_HOME environment variable set. The
Maven installation is encapsulated in the directory specified by
MAVEN_HOME: scripts, Maven's run-time library, plug-ins and the
MAVEN_HOME must not end with a path delimiter -
Note: if you already have Maven installed,
is probably already set. Unless you really want to delete that installation
completely and install the new build there, make sure you change it before
Before you can begin the process, you'll need to download the
source from the
Subversion repositories. For example, using the command line:
svn co http://svn.apache.org/repos/asf/maven/maven-1/trunks maven-1
maven-plugins tree is required for the
the bootstrap process. If you have downloaded a released source distribution
of Maven (which doesn't include the plugins), you either have to checkout
the plugins separately, or use Maven itself to
After setting the value of
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
build-bootstrap.xml, and can be
initiated by typing the following from the
ant -f build-bootstrap.xml
After initially constructing a basic Maven install with Ant, the bootstrap will use Maven to rebuild itself.
If you had any problems during building, refer to the troubleshooting section below.
Thats it! Congratulations! You have now built Maven with Maven and installed Maven on your system!
This section explains how to build Maven with Maven already installed.
This assumes that you have the
maven-1/core tree available,
either checked out from SVN, or from one of the released source distributions.
Unlike the bootstrap, the
maven-1/plugins tree is not required
as the following goals will download (if necessary) the latest plugin releases
and use those instead of building them from sources. If you wish to do this, please
read Building Plugins From Sources.
Start by running
maven -u in the
This will give you a quick overview of the defined goals.
If you are building a different version of Maven to the one currently installed,
or the one installed is your "clean" installation, you can build a complete Maven
installation with the following goals invoked from the
This builds a complete install in the
This builds a complete install in the
If you are developing a patch for Maven itself, you need a development installation of Maven that you can use and change. This should be set up using the instructions above using Maven, or by bootstrapping.
Note that when doing this, if you happen to make a valid Maven JAR that has a bug, you may render your current Maven installation unable to rebuild itself. You should keep a clean copy to use in this case, otherwise you will have to rebuild it from scratch as specified above, or by bootstrapping.
This will run the touchstone tests on the currently version of Maven. This should be run after
To build the plugins from sources, you need to have
checked out from Subversion at the same level as the
maven-1/core tree (not underneath it).
These goals have some common logic: they invoke the reactor on the plugins
directory and use the properties
to determine which to build and/or install. You can customise these variables by copying the values from
build.properties in the same directory and changing them.
It is also possible to use the
multiproject goals to do this from the
directory. For more information, refer to the Maven Plugins project
|plugins:install-all||Clean, build and install each Maven plugin into the running Maven installation (though they will not be utilised until next execution). This is the most commonly used goal.|
|plugins:test-all||Test each Maven plugin. This runs any integration tests available for individual plugins.|
|plugins:repository-deploy-all||Deploy all plugins in a remote repository.|
|plugins:site||Create the web site root for all plugins.|
|plugins:build-all-sites||Create the web site for all plugins and for the root site.|
|plugins:deploy-all-sites||Deploy the web site for all plugins and for the root site.|
|plugins:publish-all-sites||Publish the web site for all plugins and for the root site.|
If you are behind a proxy, you must define proxy parameters for building Maven. See this FAQ for details.
If you get an OutofMemoryError during bootstrap, try setting an environment variable MAVEN_OPTS to provide more memory, e.g.