Skip to content

Introduce javaVersion property for maven.compiler.* configuration#551

Merged
slawekjaranowski merged 1 commit intoapache:masterfrom
slawekjaranowski:javaVersion
Nov 14, 2025
Merged

Introduce javaVersion property for maven.compiler.* configuration#551
slawekjaranowski merged 1 commit intoapache:masterfrom
slawekjaranowski:javaVersion

Conversation

@slawekjaranowski
Copy link
Member

@slawekjaranowski slawekjaranowski commented Nov 13, 2025

child projects can simply override only one property, without additional profiles

@slawekjaranowski
Copy link
Member Author

@slawekjaranowski slawekjaranowski self-assigned this Nov 13, 2025
@slawekjaranowski slawekjaranowski added breaking Pull requests that break existing features enhancement New feature or request labels Nov 13, 2025
Copy link
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

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

Looks much better, thx !

@slawekjaranowski slawekjaranowski merged commit 9d07deb into apache:master Nov 14, 2025
3 checks passed
@github-actions github-actions bot added this to the ASF-36 milestone Nov 14, 2025
@slawekjaranowski slawekjaranowski deleted the javaVersion branch November 14, 2025 07:10
<!-- https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-release.html, affects m-compiler-p and m-javadoc-p -->
<maven.compiler.release>8</maven.compiler.release>
<minimalJavaBuildVersion>${maven.compiler.release}</minimalJavaBuildVersion>
<maven.compiler.release>${javaVersion}</maven.compiler.release>
Copy link
Member

Choose a reason for hiding this comment

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

I wish I had reviewed this prior to release. This profile should set all 3. Some plugins still read maven.compiler.source and/or maven.compiler.target (formatting tools, static analysis tools, etc.) Not all plugins have been updated to know about maven.compiler.release and use it as an alternative. It was really convenient to have these set in one spot in the parent POM. Now that they are removed, they need to be added to every child POM to avoid breaking any builds using plugins that don't use maven.compiler.release.

Copy link
Member

Choose a reason for hiding this comment

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

Also, the premise of this PR was a bit misleading: users already could set all three with one property in apache-35. They only needed to set maven.compiler.target. That's not ideal, and having the single javaVersion property is certainly better (though I prefer all lowercase, java.version or similar), but I still think the profile for 9+ should set all 3.

Copy link
Member

Choose a reason for hiding this comment

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

I opened #569 to implement my suggestion to keep the source and target properties in the jdk9+ profile.

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

Labels

breaking Pull requests that break existing features enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants