Is there a mechanism to track maven plugin version updates automatically. Since most of the time in dependencyManagement you hard-wire the version numbers for every plugin. Is there an administrative command to find this information on what newer versions are vailable for plugins declared in pom.xml?
The Versions Maven Plugin has a nice versions:display-plugin-updates
mojo for this.
To use it, simply run:
mvn versions:display-plugin-updates
Which produces something like that:
[INFO] ------------------------------------------------------------------------ [INFO] Building sandbox [INFO] task-segment: [versions:display-plugin-updates] [INFO] ------------------------------------------------------------------------ [INFO] [versions:display-plugin-updates {execution: default-cli}] [INFO] [INFO] The following plugin updates are available: [INFO] maven-clean-plugin ....................................... 2.2 -> 2.4 [INFO] maven-compiler-plugin .................................. 2.0.2 -> 2.1 [INFO] maven-deploy-plugin ...................................... 2.4 -> 2.5 [INFO] maven-install-plugin ..................................... 2.2 -> 2.3 [INFO] maven-jar-plugin ......................................... 2.2 -> 2.3 [INFO] maven-resources-plugin ................................. 2.3 -> 2.4.1 [INFO] maven-site-plugin ................................. 2.0-beta-7 -> 2.1 [INFO] maven-surefire-plugin .................................. 2.4.3 -> 2.5 [INFO] [INFO] All plugins have a version specified. [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7 seconds [INFO] Finished at: Fri Jan 22 07:21:57 CET 2010 [INFO] Final Memory: 16M/68M [INFO] ------------------------------------------------------------------------
It will also warn you if you have not specified the versions of plugins that you are using. See Checking for new plugin updates for details.
Update: (answering some additional questions posted as comments)
How does it decide to figure out the list of plugins to search for (is it from pluginManagement?)
AFAIK, the plugin should scan all plugins i.e. build.plugins
, build.pluginManagement.plugins
and build.reporting.plugins
(see MVERSIONS-83 about this).
I did a quick check on build/pluginManagement/plugins and it looks like didn't find updates for plugins other than org.apache.maven.plugins
I did a test too and this is not what I'm observing. At least it works with mojos from codehaus (like in the last sample from the previous link). But if I move the plugin in build.plugins
, it doesn't work indeed. This is actually a bug, see MVERSIONS-69. Surprisingly, it seems to work with the version 1.1 that you can run as shown below:
mvn org.codehaus.mojo:versions-maven-plugin:1.1:display-plugin-updates
And if you look closely at MVERSIONS-69, the output of the integration tests suggests that it should work with any plugin. But I confess, I'm not 100% sure.