Skip to content

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Oct 10, 2025

Defining maven.compiler.source and maven.compiler.target properties when
running on JDK >= 9 has some side effects.

Fixes #503

Defining maven.compiler.source and maven.compiler.target properties when
running on JDK >= 9 has some side effects.

Fixes apache#503
@gnodet gnodet marked this pull request as ready for review October 13, 2025 09:37
@gnodet
Copy link
Contributor Author

gnodet commented Oct 13, 2025

@slachiewicz @slawekjaranowski Note that those could be potentially moved to apache-parent if we want. Thoughts ?

@gnodet gnodet added the enhancement New feature or request label Oct 13, 2025
@gnodet gnodet added this to the 46 milestone Oct 13, 2025
@gnodet gnodet changed the title Enhance target JDK definition for JDK >= 1 Enhance target JDK definition for JDK >= 9 Oct 13, 2025
<javaVersion>8</javaVersion>
<maven.compiler.source>${javaVersion}</maven.compiler.source>
<maven.compiler.target>${javaVersion}</maven.compiler.target>
<maven.compiler.source />
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if it works on Maven 3 ....

Maybe we can do it in ASF parent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if it works on Maven 3 ....

Maven 3 already requires JDK 17 to build.

I tested the PR on maven-compiler-plugin on the maven-compiler-plugin-3.x branch with success.

Maybe we can do it in ASF parent?

Yes, definitely. There's a higher risk of disruption and currently, the main target for this change is the master branch of maven-compiler-plugin, but I'm fine with moving it up if we want.

Copy link
Member

Choose a reason for hiding this comment

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

I agree to move up, looks safe

@gnodet
Copy link
Contributor Author

gnodet commented Oct 15, 2025

I've raised apache/maven-apache-parent#543 but we'll need to keep this PR.
The reason is that the apache parent only defines maven.compiler.source, maven.compiler.target, maven.compiler.release, and minimalJavaBuildVersion. The other properties are specific to the maven-parent, so we need this PR anyway.

Comment on lines +964 to +965
<maven.compiler.source />
<maven.compiler.target />

Choose a reason for hiding this comment

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

Suggested change
<maven.compiler.source />
<maven.compiler.target />

is this the same now?

Having implicit or explicit default/undefined value is the same outcome, right?

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The maven parent should avoid setting maven.compiler.source and maven.compiler.target for JDK >= 11

3 participants