Set maven.compiler.release unconditionally and drop the JDK profiles - #609
Draft
slachiewicz wants to merge 1 commit into
Draft
Set maven.compiler.release unconditionally and drop the JDK profiles#609slachiewicz wants to merge 1 commit into
slachiewicz wants to merge 1 commit into
Conversation
maven-compiler-plugin and maven-javadoc-plugin only pass release to a JDK 9+ tool and fall back to source/target on JDK 8 by themselves, so the jdk8 and jdk9+ profiles added nothing except the toolchains flaw noted in their own comment (MNG-6943). The parent must not define source or target next to release: maven-compiler-plugin 4.x forwards all three and javac rejects the combination. See #608
slachiewicz
force-pushed
the
agent/release-from-target
branch
from
September 10, 2026 21:46
be942d7 to
8986a0b
Compare
Member
Author
|
Branch rewritten. The previous version derived This comment was created with AI assistance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #608.
maven.compiler.releaseis now set fromjavaVersionunconditionally and thejdk8andjdk9+profiles are gone. Both consumers gate the option themselves: plexus-compiler only emits--releasewhen the javac in use is 9 or newer, reading the version from the toolchain executable when forking, and the javadoc mojo checks its runtime version. That removes the toolchains flaw the old profile's comment admits (MNG-6943) and one moving part, with no behaviour change on JDK 9+.The parent deliberately does not define
maven.compiler.sourceortargetnext torelease: maven-compiler-plugin 4.x forwards all three and javac rejects the combination, which is what #543 established and why #569 was withdrawn. This PR therefore does not fix the silent override in #608 on the 3.x plugin; the docs now say plainly that a project must overridejavaVersion, notsource/target. A loud failure for the 3.x case would be an enforcer rule in a follow-up.Verified with a child project against 40-SNAPSHOT on JDK 25, reading the javac command line:
--release 8maven.compiler.target11--release 8, unchanged from 39javaVersion17--release 17maven.compiler.target11option --target cannot be used together with --release, unchanged from 39javaVersion17Behaviour change only on JDK 8 builds: this POM no longer sets
sourceandtargetthere, so the compiler plugin's own default of 1.8 applies unless the project sets them. Measured on Zulu 1.8.0_504 with Maven 3.9.16, child setting nothing:-source 8 -target 8-source 1.8 -target 1.8The compiler plugin's page says 3.13.0 "converts"
releasetosource/targeton JDK 8; MCOMPILER-582 added only ITs and docs, and its IT configures all three, so the conversion is the defaults coinciding. A child withjavaVersion7 cannot reach the difference: the parent'sRequireJavaVersionrule rejects JDK 8 for range[7,)on 39 as well. The docs module builds.This change was created with AI assistance.