Skip to content

Conversation

@adoroszlai
Copy link
Contributor

@adoroszlai adoroszlai commented Nov 15, 2025

What changes were proposed in this pull request?

Similar to apache/ratis-thirdparty#74.

  • Replace maven.compiler.source with maven.compiler.release.
  • Keep maven.compiler.target, but set it to the same as maven.compiler.release. This is required because Apache parent POM v35 uses .target as the source of truth.
  • Remove custom java.min.version and maven.min.version properties, and maven-enforcer-plugin executions that reference these. Enforcement is inherited from Parent POM (properties, execution).
  • Remove reference to non-existent property javac.source.

https://issues.apache.org/jira/browse/RATIS-2362

How was this patch tested?

Tested version enforcement with various Java and Maven versions.

Exactly minimum required versions:

$ mvn -V validate
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Java version: 1.8.0_462, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
...
[INFO] --- maven-enforcer-plugin:3.5.0:enforce (enforce-maven-version) @ ratis ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed
[INFO] 
[INFO] --- maven-enforcer-plugin:3.5.0:enforce (enforce-java-version) @ ratis ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed

Newer versions:

$ mvn -V validate
Apache Maven 3.9.11 (3e54c93a704957b63ee3494413a2b544fd3d825b)
Java version: 21.0.8, vendor: Ubuntu, runtime: /usr/lib/jvm/java-21-openjdk-amd64
...
[INFO] --- enforcer:3.5.0:enforce (enforce-maven-version) @ ratis ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed
[INFO] 
[INFO] --- enforcer:3.5.0:enforce (enforce-java-version) @ ratis ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed

Targeting Java 17:

$ mvn -V validate -Dmaven.compiler.release=17
Apache Maven 3.9.11 (3e54c93a704957b63ee3494413a2b544fd3d825b)
Java version: 21.0.8, vendor: Ubuntu, runtime: /usr/lib/jvm/java-21-openjdk-amd64
...
[INFO] --- enforcer:3.5.0:enforce (enforce-maven-version) @ ratis ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed
[INFO] 
[INFO] --- enforcer:3.5.0:enforce (enforce-java-version) @ ratis ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed

Maven too old:

$ mvn -V validate
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)
Java version: 1.8.0_462, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.5.0:enforce (enforce-maven-version) on project ratis: The plugin org.apache.maven.plugins:maven-enforcer-plugin:3.5.0 requires Maven version 3.6.3

Maven older than custom requirement:

$ mvn -V validate -DminimalMavenBuildVersion=3.9.0
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Java version: 21.0.8, vendor: Ubuntu, runtime: /usr/lib/jvm/java-21-openjdk-amd64
...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.5.0:enforce (enforce-maven-version) on project ratis: 
[ERROR] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion failed with message:
[ERROR] Detected Maven Version: 3.6.3 is not in the allowed range [3.9.0,).

Java older than target:

$ mvn -V validate -Dmaven.compiler.release=17
Apache Maven 3.9.11 (3e54c93a704957b63ee3494413a2b544fd3d825b)
Java version: 1.8.0_462, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.5.0:enforce (enforce-java-version) on project ratis: 
[ERROR] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion failed with message:
[ERROR] Detected JDK version 1.8.0-462 (JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre) is not in the allowed range [17,).

CI:
https://github.com/adoroszlai/ratis/actions/runs/19390640250

@adoroszlai
Copy link
Contributor Author

@szetszwo please take a look

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 the change looks good.

@adoroszlai adoroszlai merged commit e74f548 into apache:master Nov 19, 2025
16 checks passed
@adoroszlai adoroszlai deleted the RATIS-2362 branch November 19, 2025 06:02
@adoroszlai
Copy link
Contributor Author

Thanks @szetszwo for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants