10BC0 [NO-JIRA] Update enforcer-plugin to releasing with JDK 21 by mattrpav · Pull Request #1532 · apache/activemq · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@mattrpav
Copy link
Contributor
@mattrpav mattrpav commented Nov 11, 2025

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 mattrpav self-assigned this Nov 11, 2025
@gemmellr
Copy link
Member

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?

@mattrpav
Copy link
Contributor Author
mattrpav commented Nov 11, 2025

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

@mattrpav mattrpav force-pushed the NO-JIRA-enforcer-jdk-21 branch from 8666755 to ff3fed9 Compare November 12, 2025 14:54
@mattrpav
Copy link
Contributor Author

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.

@jbonofre jbonofre self-requested a review November 12, 2025 15:02
@mattrpav mattrpav changed the title [NO-JIRA] Update enforcer-plugin to require building with JDK 21 [NO-JIRA] Update enforcer-plugin to releasing with JDK 21 Nov 12, 2025
Copy link
Member
@jbonofre jbonofre left a comment

Choose a reason for hiding this comment

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

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.

@gemmellr
Copy link
Member

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.

@mattrpav mattrpav force-pushed the NO-JIRA-enforcer-jdk-21 branch from ff3fed9 to f251a93 Compare January 25, 2026 16:31
@mattrpav mattrpav requested review from gemmellr and jbonofre January 25, 2026 16:31
8000
<rules>
<requireMavenVersion>
<version>3.0.5</version>
<version>3.6.3</version>
Copy link
Member

Choose a reason for hiding this comment

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

The parent pom 37 now requires Maven 3.9 to build. Given 3.8.x is now entirely out of support and new plugin releases are aimed at 3.9+, I'd say its time to do the same (and have already done so in other projects). I'd also defer to its enforcer definition (by removing this one entirely) at this point to simplify the pom.

You could also get rid of the java version check below this one (but not the other one in the release profile) and defer to the parents one. They have also defined a new property in v37 to link all the java verison enforcement and compiler settings together, though personally I prefer having the compiler properties set in the components own pom and so am still setting them regardless.

Comment on lines +1344 to +1356
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.6.3</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
Copy link
Member

Choose a reason for hiding this comment

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

Could similarly remove this maven version enforcement.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0