Last month, the maven-wrapper project caught my attention on Github.
This morning, I had time to kill and I decided to take a closer look at it. I eventually played with it, forked it and added a quick and dirty feature "basic Maven plugin support".
The maven-wrapper project is a port of the Gradle wrapper to Maven.
It will download a Maven distribution automatically for you and set it up. Currently the project is just a library, more or less a work in progress at this time.
Again, I can't emphasize enough on the importance of build tools wrappers, especially on build machines. The release management folks doesn't need to follow any detailed setup guide, nor do they need to worry about managing multiple versions of the same build tools.
I did a very quick and dirty implementation of a Maven plugin, so that the code could be reused as a plugin in new or existing Maven project.
It was just a matter of adding few dependencies and writing a simple Mojo.
I eventually renamed the artifactId to have auto-mapping enabled in terms of namespace and goals.
Nowadays, it's possible to write Mojo descriptors with Java annotations instead of xdoclet-like comments.
I opened a pull request to merge the code in the original project few hours ago.
Maven wrapper plugin usage
Checkout the maven-wrapper forked project and run the Maven install goal.
In another Maven project, add the following to your build->plugins section
Maven version compatibility
<build> .. <plugins> .. <plugin> <groupId>org.apache.maven</groupId> <artifactId>wrapper-maven-plugin</artifactId> <version>0.0.1-SNAPSHOT</version> </plugin> .. </plugins> ... </build>
In terms of compilation, it should work with Maven 3.0.2 dependencies and above. The default distribution URL contains some maven versions from 2.0.9 to 3.0.5.
The distribution URL is not customizable automatically at this point (when generating the wrapper supporting files).
What would be nice to have in terms of configuration
- POM driven customization of the default settings (launcher names and location, distribution URL). It's currently possible to do it manually though.
- Token substitution inside the plugin when generating wrapper artifacts.