Wrapper scripts are a set of files that can be added to your Maven project. If people want to build this project, they don’t need to install Maven first. Instead they can call the maven wrapper script, which will download and unpack Maven into their ${user.home}/.m2/wrapper/dists folder. It is also a way to let every build the project with the same Maven version.
The Apache Maven Wrapper Plugin makes it easier to add these wrapper scripts to your project.
The scripts work like this: - download the maven-wrapper jar, if it is not available yet. - the wrapper-jar contains the code to download and run Apache Maven
There are 3 types available
Script (default): With this type the scripts will try to download the scripts via wget or curl in case of Unix based system, or use Powershell in case of Windows
Bin: With this type the maven-wrapper jar is already available in the .mvn/wrapper folder, so you don’t have to rely on wget/curl or Powershell The downside is that the project will contain a binary file in the source control management system.
Source: Since Maven already requires Java to run, why not compile and run a classfile to download the maven-wrapper jar? This type comes with a .mvn/wrapper/MavenWrapperDownloader.java which will be compiled and executed on the fly.
By default the plugin will assume the same version as the Maven runtime (calling mvn -v). But you can pick a different version. Either call mvn wrapper -DmavenVersion=x, where x is any valid Apache Maven Release, see https://search.maven.org/artifact/org.apache.maven/apache-maven Another option is adjust the distributionUrl in .mvn/wrapper/maven-wrapper.properties