Skip to content

Remove deprecated setCompilerVersion() call - #1088

Open
elharo wants to merge 1 commit into
apache:maven-compiler-plugin-3.xfrom
elharo:remove-deprecated-compilerVersion-call
Open

Remove deprecated setCompilerVersion() call#1088
elharo wants to merge 1 commit into
apache:maven-compiler-plugin-3.xfrom
elharo:remove-deprecated-compilerVersion-call

Conversation

@elharo

@elharo elharo commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

CompilerConfiguration.setCompilerVersion() is deprecated and no longer evaluated by the underlying compilers. The compilerVersion field in AbstractCompilerMojo is already @Deprecated with this Javadoc:

This parameter is no longer evaluated by the underlying compilers, instead the actual version of the javac binary is automatically retrieved.

This removes the no-op call to eliminate the deprecation warning while keeping the @Deprecated field for backward compatibility — users who still set maven.compiler.compilerVersion will get a deprecation warning but not a build error."

CompilerConfiguration.setCompilerVersion() is deprecated and no longer
evaluated by the underlying compilers. The compilerVersion field is
already @deprecated; remove the no-op call to eliminate the deprecation
warning while keeping the field for backward compatibility.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR removes a deprecated, no-op call to CompilerConfiguration.setCompilerVersion() from AbstractCompilerMojo.executeReal(), eliminating a deprecation warning while keeping the deprecated compilerVersion parameter for backward compatibility with existing user configurations.

Changes:

  • Removed the compilerConfiguration.setCompilerVersion(compilerVersion); call during compiler configuration setup.
  • Kept the deprecated compilerVersion Maven parameter intact so users still receive a deprecation warning (without breaking builds).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ascheman ascheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for chasing down these deprecation no-ops. The code change itself is correct: CompilerConfiguration.setCompilerVersion() is a deprecated no-op (plexus-compiler no longer evaluates it — a forked javac's version is auto-detected via <executable>), and this was the only place in src/main that read the compilerVersion parameter. So the removal is behavior-preserving, and keeping the @Deprecated field for backward compatibility is the right call.

One thing to address before this goes in — because this PR is what makes it wrong:

With this call gone, compilerVersion is now fully inert (nothing reads it), yet the docs still present it as a working feature. In src/site/markdown/examples/compile-using-different-jdk.md.vm:

The compilerVersion parameter can be used to specify the version of the compiler that the plugin will use. However, you also need to set fork to true for this to work.

<fork>true</fork>
<executable><!-- path-to-javac --></executable>
<compilerVersion>1.3</compilerVersion>

After this PR that <compilerVersion>1.3</compilerVersion> line does nothing. The <fork> + <executable> mechanism still selects the JDK and is fine to keep — it's just the <compilerVersion> element (and the sentence describing it) that's now dead. Could you drop those from the example in this same PR, so we don't finish deprecating the parameter while the docs still advertise it? Happy to approve once that's in.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants