Compile hook scripts to maven.compiler.release, not the running JDK - #760
Draft
slachiewicz wants to merge 2 commits into
Draft
slachiewicz wants to merge 2 commits into
slachiewicz wants to merge 2 commits into
Conversation
slachiewicz
marked this pull request as draft
September 17, 2026 19:26
verify.groovy and other pre-/post-build scripts were always compiled to the bytecode level of the JDK running Maven, so a project pinned to an older release could fail with an unrecognized bytecode version. Wire the new ScriptRunner.setTargetBytecode (maven-script-interpreter 1.8) to a scriptTargetBytecode parameter that defaults to maven.compiler.release and falls back to maven.compiler.target. Fixes #742
A defaultValue of ${maven.compiler.release} hid half of the fallback
chain (maven.compiler.target) in code and made the site text describe
the wrong default. Resolving parameter, release and target in one
method keeps the -D-then-project lookup the expression evaluator gave
the default, and lets the docs state the order and the opt-out.
slachiewicz
force-pushed
the
agent/script-target-bytecode
branch
from
September 19, 2026 23:01
e07fdad to
45b92eb
Compare
slachiewicz
marked this pull request as ready for review
September 19, 2026 23:03
slachiewicz
marked this pull request as draft
September 19, 2026 23:05
| } | ||
|
|
||
| private static MavenSession newSession(MavenExecutionRequest request) { | ||
| return new MavenSession(null, (RepositorySystemSession) null, request, null); |
Member
There was a problem hiding this comment.
as constructors in MavenSession are deprecated we can try to use a mockito to moc a session or add suppression for deprecated
slawekjaranowski
approved these changes
Sep 29, 2026
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.
The library side landed in maven-script-interpreter 1.8 (
ScriptRunner.setTargetBytecode); this wires it into the plugin. Hook scripts are compiled to the first ofscriptTargetBytecode,maven.compiler.release,maven.compiler.targetthat is set (each looked up in-Dproperties, then the project), and to the running JDK's level when none is, soverify.groovyno longer fails when a project targets an older bytecode level than the JDK running Maven.Fixes #742