activemq icon indicating copy to clipboard operation
activemq copied to clipboard

[NO-JIRA] Update enforcer-plugin to releasing with JDK 21

Open mattrpav opened this issue 1 month ago • 4 comments

I tested building with JDK 21 and then running with JDK 17 without a problem.

The docs for enforcer plugin make it read that this setting impacts runtime, but it does not in fact change the compiler-plugin values used for source/target/release.

NOTE: This needs to be merged into main after main is updated to 6.3.0-SNAPSHOT

mattrpav avatar Nov 11 '25 15:11 mattrpav

The java version rule is just about the JVM running the enforcement, i.e the current runtime. It has nothing to do with the compiler settings or what the build output compiles for / runs on, which is all independent.

Wasnt the idea to only require release builds are done with JDK 21+? This change also prevents building testing on 17+, which would ideally still be a thing if supporting/targeting it?

gemmellr avatar Nov 11 '25 16:11 gemmellr

@gemmellr good catch. I'll move this change inside the apache-release profile (edited for exact profile name)

mattrpav avatar Nov 11 '25 18:11 mattrpav

Output when building with JDK 17 and apache-release profile

% mvn -Papache-release clean install -DskipTests=true
...
[ERROR] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion failed with message:
[ERROR] You must use Java 21+ to release.

mattrpav avatar Nov 12 '25 15:11 mattrpav

This change looks good to me for the enforcer.

However, if we merge it, it means Jenkins will fail. I suggest to update Jenkinsfile as part of this PR.

I dont see mention of it enabling the apache-release profile, so I dont think it will fail unless thats being introduced elsewhere.

gemmellr avatar Nov 12 '25 16:11 gemmellr