Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven plugin version not specified

Tags:

I have just noticed that plugin's version is optional in maven. I can still build my module without specifying it. Let's take an example with maven-bundle-plugin.

<plugin>     <groupId>org.apache.felix</groupId>     <artifactId>maven-bundle-plugin</artifactId>     <extensions>true</extensions>     .... </plugin> 

I have written a simple pom.xml without a parent to try this out, so pluginManagement is not involved. I have also checked the super super pom-4.0.0.xml in maven-model-builder to confirm that maven-bundle-plugin isn't there. This plugin version is not specified anywhere.

How does maven determine which version to take?

like image 723
ceilfors Avatar asked Jun 21 '13 15:06

ceilfors


People also ask

How does Maven decide which version to use?

If you're encoding command line execution of Maven goals into your builds you should specify a version for these, otherwise your builds may change as new versions of plugins are released. This can't always be the latest. For examble a mvn clean call uses maven-clean-plugin 2.5 but 2.6 2.6. 1 and 3.0.

What are the correct type of Maven plugins?

Introduction. In Maven, there are two kinds of plugins, build and reporting: Build plugins are executed during the build and configured in the <build/> element. Reporting plugins are executed during the site generation and configured in the <reporting/> element.

What is plugin version?

A Plugin Version contains all the information about a particular version of a Plugin. Some notable fields include the URL to the plugin package, the version number and what plugin is it the version of.


1 Answers

From Maven 3.x Compatibility Notes:

Automatic Plugin Version Resolution

When a plugin was invoked without an explicit version given in the POM or on the command line, Maven 2.x used to pick the latest version available where the latest version could either be a release or a snapshot. For the sake of stability, Maven 3.x prefers the latest release version over the latest snapshot version.

Given the threat of non-reproducible builds imposed by automatic plugin version resolution, this feature is scheduled for removal as far as plugin declarations in the POM are concerned. Users of Maven 3.x will find it output a warning when missing plugin versions are detected to encourage the addition of plugin versions to the POM or one of its parent POMs. The Enforcer rule requirePluginVersions can be used additionally check for missing plugin versions in the POM.

like image 187
ceilfors Avatar answered Oct 02 '22 08:10

ceilfors