Skip to content

[MCOMPILER-481] JPMS Regression: cannot access <class> (requires static module not include anymore) #712

@jira-importer

Description

@jira-importer

Simone Bordet opened MCOMPILER-481 and commented

Version 3.8.1 is not affected.

The problem lies in how the module-path is constructed by the maven-compiler-plugin – not sure what changes from 3.8.1 caused this.

In 3.8.1:

-d
  /home/simon/tmp/compiler-bug/app/target/test-classes
-classpath
  /home/simon/tmp/compiler-bug/app/target/test-classes
  /home/simon/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.8.2/junit-jupiter-api-5.8.2.jar
  /home/simon/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar
  /home/simon/.m2/repository/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar
  /home/simon/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar
  
--module-path
  /home/simon/tmp/compiler-bug/app/target/classes
  /home/simon/.m2/repository/org/example/compiler-bug-service/1.0-SNAPSHOT/compiler-bug-service-1.0-SNAPSHOT.jar
  /home/simon/.m2/repository/org/eclipse/jetty/jetty-util-ajax/10.0.7/jetty-util-ajax-10.0.7.jar
  /home/simon/.m2/repository/org/eclipse/jetty/jetty-util/10.0.7/jetty-util-10.0.7.jar
  /home/simon/.m2/repository/org/slf4j/slf4j-api/2.0.0-alpha5/slf4j-api-2.0.0-alpha5.jar
  
-sourcepath
  /home/simon/tmp/compiler-bug/app/src/test/java
  /home/simon/tmp/compiler-bug/app/target/generated-test-sources/test-annotations
  
-s
  /home/simon/tmp/compiler-bug/app/target/generated-test-sources/test-annotations
-g
-nowarn
--release
  11
-encoding
  UTF-8
--patch-module
  compiler.bug.app=/home/simon/tmp/compiler-bug/app/target/classes
  /home/simon/tmp/compiler-bug/app/src/test/java
  /home/simon/tmp/compiler-bug/app/target/generated-test-sources/test-annotations
  
--add-reads
  compiler.bug.app=ALL-UNNAMED 

In 3.9.0:

-d
  /home/simon/tmp/compiler-bug/app/target/test-classes
-classpath
  /home/simon/tmp/compiler-bug/app/target/test-classes
  /home/simon/.m2/repository/org/eclipse/jetty/jetty-util-ajax/10.0.7/jetty-util-ajax-10.0.7.jar
  /home/simon/.m2/repository/org/eclipse/jetty/jetty-util/10.0.7/jetty-util-10.0.7.jar
  /home/simon/.m2/repository/org/slf4j/slf4j-api/2.0.0-alpha5/slf4j-api-2.0.0-alpha5.jar
  /home/simon/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.8.2/junit-jupiter-api-5.8.2.jar
  /home/simon/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar
  /home/simon/.m2/repository/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar
  /home/simon/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar
  
--module-path
  /home/simon/tmp/compiler-bug/app/target/classes
  /home/simon/.m2/repository/org/example/compiler-bug-service/1.0-SNAPSHOT/compiler-bug-service-1.0-SNAPSHOT.jar
  
-sourcepath
  /home/simon/tmp/compiler-bug/app/src/test/java
  /home/simon/tmp/compiler-bug/app/target/generated-test-sources/test-annotations
  
-s
  /home/simon/tmp/compiler-bug/app/target/generated-test-sources/test-annotations
-g
-nowarn
--release
  11
-encoding
  UTF-8
--patch-module
  compiler.bug.app=/home/simon/tmp/compiler-bug/app/target/classes
  /home/simon/tmp/compiler-bug/app/src/test/java
  /home/simon/tmp/compiler-bug/app/target/generated-test-sources/test-annotations
  
--add-reads
  compiler.bug.app=ALL-UNNAMED 

Running with 3.9.0 yields:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.9.0:testCompile (default-testCompile) on project compiler-bug-app: Compilation failure
[ERROR] /home/simon/tmp/compiler-bug/app/src/test/java/org/test/app/MainTest.java:[12,38] cannot access org.eclipse.jetty.util.ajax.JSON
[ERROR]   class file for org.eclipse.jetty.util.ajax.JSON not found 

Class JSON is in {}jetty-util-10.0.7.jar{}.

In 3.9.0 this jar is missing from the module-path, causing the error.

Attached you can find a reproducer: switch the maven-compiler-plugin version from 3.8.1 (works) to 3.9.0 (does not work) in the main POM.


Affects: 3.9.0

Attachments:

Issue Links:

Remote Links:

1 votes, 8 watchers

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority:blockerBlocks development and/or testing work, production could not run

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions