Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnforceBytecodeVersion fails with "Restricted to JDK 11 yet […] contains […] targeted to JDK 17" #582

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

basil
Copy link
Member

@basil basil commented Feb 21, 2024

End-to-end testing of Text Finder with a Jenkins core compiled with -Dmaven.compiler.release=17 showed that #578 was incomplete: since the initialize logic ran after the Enforcer logic, the Enforcer logic still used the lowest supported Java version (not the automatically detected one) and failed. Fixed by moving the initialize logic to the validate file. This has the added benefit of making the code more readable by putting the (related) logic that writes the marker file and the logic that updates the value in-memory to an adjacent location in the same file.

Testing done

Built a Jenkins core with -Dmaven.compiler.release=17, then ran mvn clean verify in Text Finder with that core and tip-of-trunk maven-hpi-plugin vs this PR. At tip-of-trunk, it failed with the Enforcer error shown above; with this PR it passes.

@basil basil added the bug label Feb 21, 2024
@basil basil requested a review from Vlatombe February 21, 2024 20:49
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Thanks!

@basil basil merged commit 47b6b67 into jenkinsci:master Feb 22, 2024
5 checks passed
@basil basil deleted the java17-property branch February 22, 2024 14:00
@basil
Copy link
Member Author

basil commented Feb 22, 2024

After testing this further, I see that this PR didn't actually fix the problem: I had forgotten to run git clean -fxd before testing this PR. The problem only occurs on a clean checkout: after the marker file is present, interpolation works as expected. So after writing the marker file, we not only need to update the in-memory settings for the Maven Compiler Plugin, but also we need to update them for Enforcer. I will look into this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants