[NO-JIRA] Update enforcer-plugin to releasing with JDK 21
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
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 good catch. I'll move this change inside the apache-release profile (edited for exact profile name)
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.
This change looks good to me for the enforcer.
However, if we merge it, it means Jenkins will fail. I suggest to update
Jenkinsfileas 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.