Maven Wrapper
If you want to ensure that a project is always build with a certain Maven version or JDK you can either define rules using the Maven enforcer plugin. But this leaves the user alone with an error message when the user's environment does not match the requirements. With the Maven Wrapper you not only ensure the correct versions, but also provide the possibility to automatically download them so project is fully encapsulated from the user's environment.
One tool - three parts
The Maven Wrapper is divided into three parts
- The Maven Wrapper Plugin to set up and run the Maven Wrapper.
- The Maven Wrapper JAR which downloads the desired versions.
- The Maven Wrapper Distribution provides everything that has to be installed into a project wanting to use Maven Wrapper.
Usage
To use the Maven Wrapper you first define the desired versions (and maybe URLs) in a wrapper/maven-wrapper.properties
file inside the .mvn
folder of your project.
The Maven Wrapper plugin picks up this property file and installs everything defined.
After that you can build the project using the Wrapper by calling ./mvnw <goals>
(or mvnw.cmd <goals>
on Windows).
The full detailed information and documentation is available on the Maven Wrapper documentation.