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

Plexus-compiler-eclipse fails to resolve module dependency #380

Open
xazap opened this issue Mar 23, 2024 · 0 comments
Open

Plexus-compiler-eclipse fails to resolve module dependency #380

xazap opened this issue Mar 23, 2024 · 0 comments

Comments

@xazap
Copy link

xazap commented Mar 23, 2024

Description

I ran into an issue where the the plexus-compiler-eclipse 2.15.0 fails to resolve a compile-scoped dependency that is correctly referenced by the module name listed in its module-info.

I have created a minimal Maven project to reproduce the issue that will also show that Javac is able to compile correctly whereas the Plexus-compiler-eclipse is not. Note that Eclipse 2024-03 IDE has no issue resolving the module, so I suspect the issue is with Plexus compiler and not with ECJ itself.

Reproduction of the issue

Please clone this repo and reproduce the issue with mvn clean compile -f pom-using-ecj.xml:

[INFO] --- compiler:3.12.1:compile (default-compile) @ test ---
[INFO] Recompiling the module because of changed source code.
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling with eclipse [debug release 17 module-path] to target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/xazap/Projects/plexus-bug/src/main/java/module-info.java:[3,22] org.slf4j cannot be resolved to a module
[ERROR] /home/xazap/Projects/plexus-bug/src/main/java/test/Test.java:[3,8] The type org.slf4j.Logger is not accessible
[ERROR] /home/xazap/Projects/plexus-bug/src/main/java/test/Test.java:[4,8] The type org.slf4j.LoggerFactory is not accessible
[ERROR] /home/xazap/Projects/plexus-bug/src/main/java/test/Test.java:[8,23] Logger cannot be resolved to a type
[ERROR] /home/xazap/Projects/plexus-bug/src/main/java/test/Test.java:[8,39] LoggerFactory cannot be resolved
[ERROR] /home/xazap/Projects/plexus-bug/src/main/java/test/Test.java:[11,3] Logger cannot be resolved to a type
[INFO] 6 errors 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

The issue does not appear when using Javac as the compiler as proven by mvn clean compile -f pom-using-javac.xml:

[INFO] --- compiler:3.12.1:compile (default-compile) @ test ---
[INFO] Recompiling the module because of changed source code.
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 2 source files with javac [debug release 17 module-path] to target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
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

No branches or pull requests

1 participant