The project codebase has been accepted to be included in the upstream Apache Maven project itself. Currently the plan is to release the wrapper as a feature of the upcoming Maven 3.7.0 release. For this purpose the following resources are available:
We encourage any users and contributors to work with us within the Apache Maven project on any further changes.
This project is essentially frozen now.
The Maven Wrapper is an easy way to ensure a user of your Maven build has everything necessary to run your Maven build.
Why might this be necessary? Maven to date has been very stable for users, is available on most systems or is easy to procure: but with many of the recent changes in Maven it will be easier for users to have a fully encapsulated build setup provided by the project. With the Maven Wrapper this is very easy to do and it's a great idea borrowed from Gradle.
The easiest way to setup the Maven Wrapper for your project is to use the
Takari Maven Plugin with its provided
wrapper goal. To add or update all
the necessary Maven Wrapper files to your project execute the following command:
mvn -N io.takari:maven:0.7.7:wrapper
Note: The default usage should be
mvn -N io.takari:maven:wrapperbut for some users this seem to result in usage of an old version of the wrapper and therefore installation of older Maven defaults and so on.
Normally you instruct users to install a specific version of Apache Maven, put
it on the PATH and then run the
mvn command like the following:
mvn clean install
But now, with a Maven Wrapper setup, you can instruct users to run wrapper scripts:
./mvnw clean install
or on Windows
mvnw.cmd clean install
A normal Maven build will be executed with the one important change that if the
user doesn't have the necessary version of Maven specified in
.mvn/wrapper/maven-wrapper.properties it will be downloaded for the user
first, installed and then used.
Subsequent uses of
mvnw.cmd use the previously downloaded, specific
version as needed.
The wrapper should work on various operating systems including
For all those *nix operating systems, various shells should work including
In terms of Apache Maven versions itself, the wrapper should work with any Maven 3.x version and it defaults to the latest release - currently 3.6.3. We do NOT plan to support the deprecated, EOL'ed Maven 2.x.
The maven-wrapper itself is compiled to work with Java 5. The Takari Maven Plugin for installation however uses Java 7. Once the wrapper is installed with the plugin you should be able to use the wrapper on the project with Java 5 and up. This is however not really tested by the committers.
Please check out the changelog for more information about our releases.
The wrapper supports a verbose mode in which it outputs further information. It
is activated by setting the
MVNW_VERBOSE environment variable to
By default it is off.
By default, the Maven Wrapper JAR archive is added to the using project as small
.mvn/wrapper/maven-wrapper.jar. It is used to bootstrap the
download and invocation of Maven from the wrapper shell scripts.
If your project is not allowed to contain binary files like this, you can configure your version control system to exclude checkin/commit of the wrapper jar.
If the JAR is not found to be available by the scripts they will attempt to
download the file from the URL specified in
wrapperUrl and put it in place.
The download is attempted via curl, wget and, as last resort, by compiling the
./mvn/wrapper/MavenWrapperDownloader.java file and executing the resulting
If your Maven repository is password protected you can specify your username via
the environment variable
MVNW_USERNAME and the password via the environment
To switch the version of Maven used to build a project you can initialize it using:
mvn -N io.takari:maven:0.7.7:wrapper -Dmaven=3.5.4
which works for any version except snapshots. Once you have a wrapper you can
change its version by setting the
To download Maven from a location that requires Basic Authentication you have 2 options:
Set the environment variables MVNW_USERNAME and MVNW_PASSWORD
add user and password to the distributionUrl like that:
This is a feature of Maven itself and the wrapper just happens to take it into
account. Simply set
MAVEN_USER_HOME to the desired path and the wrapper uses
it as the base of the Maven distro installation.
See https://www.lewuathe.com/maven-wrapper-home.html and https://github.com/takari/maven-wrapper/issues/17
When using an internal Maven repository manager you have two options:
maven-wrapper.propertiesin your project
MVNW_REPOURLto your repo manager URL such as
MVNW_REPOURL is set during the wrapper installation with the
takari-maven-plugin, the URL is used in the maven-wrapper.properties file.
If not set, but your mirror URL in your settings.xml is configured, it will be used.
To test Maven wrapper usage:
mvn -N -X io.takari:maven:0.7.7-SNAPSHOT:wrapper
Updating Maven version: