Hello!
I am unable to find information about my situation so I email you.
I have a pom.xml with maven-enforcer-plugin set to <version>3.8.6</version> and in a single project it produces what expected:
[INFO] --- versions-maven-plugin:2.18.0:display-plugin-updates (default-cli) @ tools ---
[INFO]
[INFO] The following plugin updates are available:
[INFO] maven-clean-plugin ................................. 3.1.0 -> 3.4.1
[INFO] maven-compiler-plugin ............................ 3.10.0 -> 3.14.0
[INFO] maven-dependency-plugin ............................ 3.1.2 -> 3.8.1
....
this is good!
But I also have a second project, one with a parent pom and modules
pom.xml (parent)
<modules>
<module>module1</module>
<module>module2</module>
</modules>
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.18.0</version>
<configuration>
<rulesUri>[filepath to rules]</rulesUri>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.8.6</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
and in model1 and 2's pom.xml
<plugins>
...
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
</plugin>
</plugins>
as stated from error message if not:
[INFO] --- versions-maven-plugin:2.18.0:display-plugin-updates (default-cli) @ module1 ---
[INFO]
[INFO] All plugins with a version specified are using the latest versions.
[INFO]
[INFO] All plugins have a version specified.
[INFO]
[WARNING] Project does not define minimum Maven version required for build
[INFO] Plugins require minimum Maven version of: null
[INFO]
[ERROR] Project does not define required minimum version of Maven.
[ERROR] Update the pom.xml to contain maven-enforcer-plugin to
[ERROR] force the Maven version which is needed to build this project.
[ERROR] See
https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html
[ERROR] Using the minimum version of Maven: null
but when I run from parent pom.xml location, where compilation and all works from, mvn versions:use-latest-releases too.
I get a parent pom.xml error:
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.18.0:display-plugin-updates (default-cli) @ parent ---
[INFO]
[INFO] All plugins with a version specified are using the latest versions.
[INFO]
[INFO] All plugins have a version specified.
[INFO]
[WARNING] Project does not define minimum Maven version required for build
[INFO] Plugins require minimum Maven version of: 3.6.3
[INFO]
[ERROR] Project does not define required minimum version of Maven.
[ERROR] Update the pom.xml to contain maven-enforcer-plugin to
[ERROR] force the Maven version which is needed to build this project.
[ERROR] See
https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html
[ERROR] Using the minimum version of Maven: 3.6.3
[INFO] Require Maven 2.0 to use the following plugin updates:
[INFO] maven-clean-plugin ................................... 3.1.0 -> 2.2
[INFO] maven-compiler-plugin ............................. 3.10.0 -> 2.0.2
[INFO] maven-deploy-plugin .................................. 2.8.2 -> 2.4
[INFO] maven-install-plugin ................................. 2.5.2 -> 2.2
[INFO] maven-jar-plugin ..................................... 3.0.2 -> 2.1
[INFO]
[INFO] Require Maven 2.0.3 to use the following plugin updates:
[INFO] maven-dependency-plugin .............................. 3.3.0 -> 2.2
[INFO] maven-surefire-report-plugin .................... 3.0.0-M5 -> 2.4.3
...
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.18.0:display-plugin-updates (default-cli) @ module1 ---
[INFO]
[INFO] All plugins with a version specified are using the latest versions.
[INFO]
[INFO] All plugins have a version specified.
[INFO]
[INFO] Project requires minimum Maven version for build of: 3.8.6
[INFO] Plugins require minimum Maven version of: null
[INFO]
[INFO] No plugins require a newer version of Maven than specified by the pom.
...
questions
It seems it does not read the enforcer in the parent pom?
I have faild to find documentation about this plugin and parent pom, but think it should be a fairly common use case, are there other plugins for this?
Is there a way to also trigger an update of the plugins too? same as use-latest-releases do?
I wonder if I could look at this my self and found the source code and this mailing list so far, but wonder what is the future of this plugin, will it move and change due to maven 4?
kind regards
Kim