Fix handling of Java versions like 21.0.10.0.1 by parttimenerd · Pull Request #967 · apache/maven-enforcer (original) (raw)
The pull request allows the Java version requirement to be satisfied even when the normalized Java version differs, as long as the exact version strings are equal between the expected and the actual versions.
This allows the common CI pattern
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.6.2</version>
<executions>
<execution>
<id>enforce-java</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>${java.version}</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>To succeed even when the Java version normalization can't handle the specific version format. This is rather hard to test, but all existing test cases succeed, and the diff is minimal.
- I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004