So, I'm trying to use the latest version of some plugins. Earlier I've used the prerequisites-tag but lots of resources (example) say that it should be considered deprecated and that the maven-enforcer-plugin should be used instead. this is my configuration:
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>enforce-maven-3</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.0.4</version>
</requireMavenVersion>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
However, when I run mvn versions:display-plugin-updates I still get this text:
[ERROR] Project does not define required minimum version of Maven.
[ERROR] Update the pom.xml to contain
[ERROR] <prerequisites>
[ERROR] <maven>3.0</maven>
[ERROR] </prerequisites>
[INFO]
[INFO] Require Maven 2.0.6 to use the following plugin updates:
[INFO] maven-jar-plugin ................................................ 2.4
[INFO] maven-shade-plugin ............................................ 1.7.1
[INFO]
[INFO] Require Maven 2.2.1 to use the following plugin updates:
[INFO] maven-jar-plugin ................................................ 2.6
[INFO]
[INFO] Require Maven 3.0 to use the following plugin updates:
[INFO] maven-shade-plugin .............................................. 2.3
Using the prerequisites-tag instead works.
It seems like this issue has been reported here (credits go to Aleksandr M for finding this).
Apparently, the display-dependency-updates goal relies on the prerequisites
element to find out the Maven version required by the current project and totally ignores the enforcer-plugin, even though the prerequisites-tag should not be used normally, it is required in order to get the dependency plugin to behave as expected.