10000 Update the "non-javac-compilers" guide and add an integration test. by desruisseaux · Pull Request #937 · apache/maven-compiler-plugin · GitHub
[go: up one dir, main page]

Skip to content

Update the "non-javac-compilers" guide and add an integration test. #937

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

desruisseaux
Copy link
Contributor

Fix #904.

@desruisseaux desruisseaux requested a review from Bukama June 21, 2025 20:43
@Bukama
Copy link
Contributor
Bukama commented Jun 22, 2025

Hi, will have a look in the next days or next weekend. Modt prob during the next days, when at an unconference.

Copy link
Contributor
@Bukama Bukama left a comment

Choose a reason for hiding this comment

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

Overall good, only small suggestions/questions

<configuration>
<compilerId>eclipse</compilerId>
<compilerId>ecj</compilerId>
<!-- TODO: remove source and target after we identified where Maven inherits those values. -->
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest to create an issue for this, so it's more visible

public static void main(final String[] args) {
String dummy = new Integer(1);
System.out.println("Hi!");
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi! is not Hello world :D

Currently, the Compiler Plugin is bundled with the <<<javac>>> compiler
with artifactId <<<plexus-compiler-javac>>> version <<${plexusCompilerVersion}>>,
which can be seen as one of the dependencies declared inside the Compiler Plugin's POM.
By default, the Compiler Plugin uses the <<<javac>>> compiler
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
By default, the Compiler Plugin uses the <<<javac>>> compiler
By default, the Maven Compiler Plugin uses the <<<javac>>> compiler

which can be seen as one of the dependencies declared inside the Compiler Plugin's POM.
By default, the Compiler Plugin uses the <<<javac>>> compiler
bundled in the <<<javax.tools>>> package of the standard Java library.
But it is possible to use any other implementation, provided that the
Copy link
Contributor

Choose a reason for hiding this comment

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

Reads bumby, maybe this is a little less rocky?

But it is possible to use any other compiler, as long the implementation declares itself as a ....

bundled in the <<<javax.tools>>> package of the standard Java library.
But it is possible to use any other implementation, provided that the
implementation declares itself as a <<<javax.tools.JavaCompiler>>> service.
For using such implementation:
Copy link
Contributor

Choose a reason for hiding this comment

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

8000
Suggested change
For using such implementation:
To use such an implementation:

dependency when declaring the plugin in your project's <<<pom.xml>>>. The example
below shows how to use the <<<csharp>>> compiler:
The example below shows how to use the Eclipse compiler <<<ecj>>>.
Note that at the contrary of Maven 3, there is no Plexus dependency to add.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does Plexus pops up here?

Copy link
Contributor Author
@desruisseaux desruisseaux Jun 23, 2025

Choose a reason for hiding this comment

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

In Maven 3, it was necessary to add two dependencies:

  • The Eclipse compiler
  • A Plexus extension which was a wrapper around the Eclipse compiler.

Actually, the Plexus extension had the Eclipse compiler as a transitive dependency, so it may look as a single dependency in the pom.xml.

In Maven 4, there is no longer wrappers around the various compilers. The Eclipse compiler is used directly (through the standard javax.tools.JavaCompiler interface). I mentioned that in case some users were aware of the use of Plexus as an intermediate API, and were wondering whether Plexus was still needed. But I have no problem in omitting this details if too distracting.

dependency when declaring the plugin in your project's <<<pom.xml>>>. The example
below shows how to use the <<<csharp>>> compiler:
The example below shows how to use the Eclipse compiler <<<ecj>>>.
Note that at the contrary of Maven 3, there is no Plexus dependency to add.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this configuration is limited to Maven 3/4 or useable with both? Maybe should be noticed to be clear (esp. as some things are only limit to version 4.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This configuration (without Plexus) works with the Maven Compiler Plugin 4 only, which itself requires Maven 4.

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

Successfully merging this pull request may close these issues.

[MCOMPILER-609] Update "non-javac-compilers"-guide
2 participants
0