Open
Description
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
Metadata
Metadata
Assignees
Labels
No labels