Uploaded image for project: 'Maven Compiler Plugin'
  1. Maven Compiler Plugin
  2. MCOMPILER-481

JPMS Regression: cannot access <class> (requires static module not include anymore)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 3.9.0
    • 3.10.0
    • None

    Description

      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.

      Attachments

        1. compiler-bug.tar.gz
          2 kB
          Simone Bordet

        Issue Links

          Activity

            People

              olamy Olivier Lamy
              sbordet Simone Bordet
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: