Reputation: 62712
In a variety of places online I have seen it discussed that for a maven build to be reproducible it is important to explicitly specify the version numbers of all the plugins used so that a newer plugin does not break the build. The recommend approach seemed to be to use the enforcer plugin. Below is a copy and pasted settings I found online.
<execution>
<id>enforce-plugin-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requirePluginVersions>
<message>Best Practice is to always define plugin versions!</message>
<banLatest>true</banLatest>
<banRelease>true</banRelease>
<banSnapshots>true</banSnapshots>
<phases>clean,deploy,site</phases>
<additionalPlugins>
<additionalPlugin>org.apache.maven.plugins:maven-eclipse-plugin</additionalPlugin>
<additionalPlugin>org.apache.maven.plugins:maven-reactor-plugin</additionalPlugin>
</additionalPlugins>
<unCheckedPluginList>org.apache.maven.plugins:maven-enforcer-plugin,org.apache.maven.plugins:maven-idea-plugin</unCheckedPluginList>
</requirePluginVersions>
</rules>
</configuration>
</execution>
When I run the pom I get the following error from the enforcer plugin.
[INFO] --- maven-enforcer-plugin:1.1.1:enforce (enforce-plugin-versions) @ seedling ---
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequirePluginVersions failed with message:
Some plugins are missing valid versions:(LATEST RELEASE SNAPSHOT are not allowed )
org.apache.maven.plugins:maven-clean-plugin. The version currently in use is 2.4.1
org.apache.maven.plugins:maven-deploy-plugin. The version currently in use is 2.7
org.apache.maven.plugins:maven-install-plugin. The version currently in use is 2.3.1
org.apache.maven.plugins:maven-site-plugin. The version currently in use is 3.0
org.apache.maven.plugins:maven-reactor-plugin. The version currently in use is 1.0
org.apache.maven.plugins:maven-eclipse-plugin. The version currently in use is 2.9
Best Practice is to always define plugin versions!
It seems to me that some plugins are such as maven-clean-plugin,maven-install-plugin,maven-reactor-plugin are a core central part of maven, and i should have the versions of these "core" plugins tied to the version of maven that I am using.
My questions:
Upvotes: 3
Views: 1122
Reputation: 5265
Maven binds some plugin to its lifecycle phases, e.g. the maven-compiler-plugin to the compile
phase, the maven-install-plugin to the install
phase and so on. These are the plugins that you mean by "a core central part of maven". However, these plugins have an individual release cycle. For example, take a look at the maven-deploy-plugin which is bound to maven's deploy
lifecycle phase. The latest release (2.7) was in October 2011 whereas the latest Maven release (3.0.4) was in January 2012. Another example is the maven-compiler-plugin whose latest release was in June 2012, half a year after the release of Maven 3.0.4.
To answer your questions in particular:
Upvotes: 3
Reputation: 97487
Here the answers to the list of questions:
Upvotes: 2