Maven Command Line Wrapper as Maven plugin
Java Shell Batchfile
Pull request Compare This branch is 70 commits ahead, 4 commits behind bdemers:master.

README.org

Maven Command Line Wrapper

https://img.shields.io/hexpm/l/plug.svg https://travis-ci.org/rimerosolutions/maven-wrapper.png https://img.shields.io/maven-central/v/com.rimerosolutions.maven.plugins/wrapper-maven-plugin.svg

Overview

This is a copy of the Gradle wrapper ported for use with Apache Maven. maven-wrapper is available from Maven Central.

The Maven Command Line Wrapper will auto-download and install Apache Maven from the Internet and then run your Maven goals. maven-wrapper ships as Maven plugin that generates wrapper scripts and a configuration file to bootstrap Maven download and installation.

Rationale

This is a fork of bdemers’ maven-wrapper in order to provide the Maven Wrapper as a Maven plugin, for more flexible reuse/integration. Once you have a Maven project that you want to distribute, you can generate a wrapper so that:

  • The target audience can easily execute Maven goals without an existing Maven application as a pre-requisite.
  • You can control the version of Maven that is to be used to build the project, if are versions compatibility concerns.

Integration example

For a full and small practical integration example, checkout the Maven Command Line Wrapper Example project.

If you used to run

mvn clean install

Then you would now run (without a leading ./ for MS Windows)

./mvnw clean install

A wrapper created with Maven 3.0.4 will request Maven 3.0.4, if it’s not already installed on the user’s machine. However, you can still request a specific Maven version by overriding the default behaviour (Maven plugin configuration).

Notes: You need a valid JDK at least 1.6. The plugin was tested with Maven 3.0.2 and above.

Maven Goals and Usage

For the list of goals and a usage guide, please consult the Wiki.

Generating the Maven wrapper

After integrating the wrapper into your Maven project (plugin section), run the following command to generate the wrapper.

mvn wrapper:wrapper

The mvnw and mwnw.bat command wrappers are generated at the root of the project folder.

The maven folder is generated with the relevant jar and properties file in the project directory.

You can now start using either the mvnw or mvnw.bat commands on any project without an existing maven installation!

Articles

http://jakub.marchwicki.pl/posts/2015/06/04/maven-wrapper/

Contributing

Pull requests, issues creation, suggestions, documentation improvements are welcome.

Big thank you to all of you who contributed to this project so far.