Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-2192

Module path missing transitive dependency

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.1.2
    • None
    • None
    • Azul JDK 20.0.2
      Microsoft Windows [Version 10.0.19045.3393]

    Description

      I've got a project with the following dependency tree:

      [INFO] --- dependency:3.6.0:tree (default-cli) @ server ---
      [INFO] gg.soulbound.optimus:server:jar:1.0-SNAPSHOT
      [INFO] +- gg.soulbound.optimus:common:jar:1.0-SNAPSHOT:compile
      [INFO] |  \- com.google.guava:guava:jar:32.1.2-jre:compile
      [INFO] |     +- com.google.guava:failureaccess:jar:1.0.1:compile
      [INFO] |     +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
      [INFO] |     +- com.google.errorprone:error_prone_annotations:jar:2.18.0:compile
      [INFO] |     \- com.google.j2objc:j2objc-annotations:jar:2.8:compile
      [INFO] +- gg.soulbound.optimus:requirements-generator:jar:1.0-SNAPSHOT:compile
      [INFO] |  \- com.github.cowwoc.requirements:java:jar:8.0.10:compile
      [INFO] |     +- com.github.cowwoc.requirements:annotations:jar:8.0.10:compile
      [INFO] |     +- com.github.cowwoc.requirements:natives:jar:8.0.10:compile
      [INFO] |     +- io.github.java-diff-utils:java-diff-utils:jar:4.12:compile
      [INFO] |     \- com.github.cowwoc.pouch:core:jar:4.0:compile
      [INFO] +- gg.soulbound.optimus:database:jar:1.0-SNAPSHOT:compile
      [INFO] |  +- org.postgresql:postgresql:jar:42.6.0:compile
      [INFO] |  |  \- org.checkerframework:checker-qual:jar:3.31.0:runtime
      [INFO] |  +- p6spy:p6spy:jar:3.9.1:compile
      [INFO] |  +- org.flywaydb:flyway-core:jar:9.21.2:compile
      [INFO] |  |  \- com.fasterxml.jackson.dataformat:jackson-dataformat-toml:jar:2.15.2:compile
      [INFO] |  +- org.jooq:jooq:jar:3.18.5:compile
      [INFO] |  |  \- io.r2dbc:r2dbc-spi:jar:1.0.0.RELEASE:compile
      [INFO] |  |     \- org.reactivestreams:reactive-streams:jar:1.0.3:compile
      [INFO] |  +- org.jooq:jooq-meta:jar:3.18.5:compile
      [INFO] |  |  \- jakarta.xml.bind:jakarta.xml.bind-api:jar:3.0.0:compile
      [INFO] |  |     \- com.sun.activation:jakarta.activation:jar:2.0.0:compile
      [INFO] |  +- gg.soulbound.optimus:jooq-plugin:jar:1.0-SNAPSHOT:compile
      [INFO] |  |  \- org.jooq:jooq-codegen:jar:3.18.5:compile
      [INFO] |  +- com.zaxxer:HikariCP:jar:5.0.1:compile
      [INFO] |  \- org.threeten:threeten-extra:jar:1.7.2:compile
      [INFO] +- com.google.code.gson:gson:jar:2.10.1:compile
      [INFO] +- gg.soulbound.optimus:domain:jar:1.0-SNAPSHOT:compile
      [INFO] |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.15.2:compile
      [INFO] +- gg.soulbound.optimus:client:jar:1.0-SNAPSHOT:compile
      [INFO] +- org.eclipse.jetty:jetty-client:jar:12.0.0:compile
      [INFO] |  +- org.eclipse.jetty:jetty-http:jar:12.0.0:compile
      [INFO] |  |  \- org.eclipse.jetty:jetty-util:jar:12.0.0:compile
      [INFO] |  +- org.eclipse.jetty:jetty-io:jar:12.0.0:compile
      [INFO] |  \- org.eclipse.jetty:jetty-alpn-client:jar:12.0.0:compile
      [INFO] +- org.eclipse.jetty.http3:jetty-http3-server:jar:12.0.0:compile
      [INFO] |  +- org.eclipse.jetty:jetty-server:jar:12.0.0:compile
      [INFO] |  +- org.eclipse.jetty.http3:jetty-http3-common:jar:12.0.0:compile
      [INFO] |  |  +- org.eclipse.jetty.http3:jetty-http3-qpack:jar:12.0.0:compile
      [INFO] |  |  \- org.eclipse.jetty.quic:jetty-quic-common:jar:12.0.0:compile
      [INFO] |  |     \- org.eclipse.jetty.quic:jetty-quic-quiche-common:jar:12.0.0:compile
      [INFO] |  |        \- org.mortbay.jetty.quiche:jetty-quiche-native:jar:0.16.0:compile
      [INFO] |  \- org.eclipse.jetty.quic:jetty-quic-server:jar:12.0.0:compile
      [INFO] |     \- org.eclipse.jetty.quic:jetty-quic-quiche-jna:jar:12.0.0:compile
      [INFO] |        \- net.java.dev.jna:jna-jpms:jar:5.13.0:compile
      [INFO] +- org.slf4j:slf4j-api:jar:2.0.7:compile
      [INFO] +- org.slf4j:jul-to-slf4j:jar:2.0.7:compile
      [INFO] +- ch.qos.logback:logback-classic:jar:1.4.10:compile
      [INFO] |  \- ch.qos.logback:logback-core:jar:1.4.10:compile
      [INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.15.2:compile
      [INFO] |  \- com.fasterxml.jackson.core:jackson-core:jar:2.15.2:compile
      [INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.15.2:compile
      [INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.15.2:compile
      [INFO] +- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.15.2:compile
      [INFO] +- io.github.classgraph:classgraph:jar:4.8.162:compile
      [INFO] +- com.github.lalyos:jfiglet:jar:0.0.9:compile
      [INFO] +- org.testng:testng:jar:7.8.0:test
      [INFO] |  +- com.beust:jcommander:jar:1.82:test
      [INFO] |  \- org.webjars:jquery:jar:3.6.1:test
      [INFO] +- io.sentry:sentry:jar:6.28.0:compile
      [INFO] +- io.sentry:sentry-logback:jar:6.28.0:compile
      [INFO] \- io.sentry:sentry-jdbc:jar:6.28.0:compile
      [INFO] ------------------------------------------------------------------------
      

      As you can see, my project depends on flyway which depends on gson.

      When I invoke

      System.out.println(ModuleLayer.boot().modules().stream().map(Module::getName).toList());`
      

      from `main()` I get:

      [jfiglet, org.threeten.extra, org.eclipse.jetty.alpn.client, com.fasterxml.jackson.datatype.jsr310, com.github.cowwoc.requirements.java, com.google.gson, jdk.javadoc, java.prefs, com.fasterxml.jackson.annotation, ch.qos.logback.core, org.eclipse.jetty.server, org.jooq, io.github.javadiffutils, jul.to.slf4j, org.postgresql.jdbc, jdk.crypto.mscapi, p6spy, gg.soulbound.optimus.client, com.github.cowwoc.requirements.annotation, jdk.charsets, jdk.accessibility, jdk.unsupported, org.eclipse.jetty.client, org.eclipse.jetty.http3.qpack, jdk.jpackage, jdk.naming.dns, com.fasterxml.jackson.core, gg.soulbound.optimus.common, com.fasterxml.jackson.databind, java.compiler, gg.soulbound.optimus.requirements, jdk.compiler, jdk.naming.rmi, java.security.jgss, com.fasterxml.jackson.module.paramnames, jdk.internal.le, org.eclipse.jetty.io, com.github.cowwoc.requirements.natives, com.fasterxml.jackson.dataformat.toml, jdk.jdeps, jdk.security.jgss, gg.soulbound.optimus.database, jdk.crypto.cryptoki, com.fasterxml.jackson.datatype.jdk8, java.security.sasl, sentry.logback, org.reactivestreams, java.xml, java.sql, jdk.crypto.ec, java.naming, java.base, org.flywaydb.core, jdk.unsupported.desktop, org.eclipse.jetty.util, jdk.zipfs, jdk.random, r2dbc.spi, jdk.jfr, java.datatransfer, ch.qos.logback.classic, java.management, jdk.jlink, gg.soulbound.optimus.domain, com.zaxxer.hikari, java.xml.crypto, com.github.cowwoc.pouch.core, java.rmi, java.smartcardio, io.github.classgraph, org.slf4j, jdk.security.auth, jdk.internal.opt, java.desktop, jdk.localedata, gg.soulbound.optimus.server, java.management.rmi, jdk.management, com.google.common, java.transaction.xa, org.eclipse.jetty.http, jdk.jartool, sentry, java.logging, jdk.management.jfr, sentry.jdbc]
      

      but when I run the same line from inside a unit test I get:

      [org.testng, j2objc.annotations, jdk.management.agent, com.fasterxml.jackson.core, java.instrument, org.checkerframework.checker.qual, jdk.jshell, jdk.random, java.rmi, jdk.javadoc, java.sql.rowset, java.prefs, jdk.net, jdk.crypto.mscapi, java.management.rmi, jdk.jpackage, java.xml.crypto, com.fasterxml.jackson.datatype.jsr310, org.threeten.extra, sentry.logback, ch.qos.logback.core, jdk.unsupported, com.github.cowwoc.requirements.natives, jdk.compiler, org.eclipse.jetty.server, jdk.management, java.net.http, java.desktop, jdk.localedata, jdk.internal.opt, jul.to.slf4j, jdk.charsets, io.github.classgraph, p6spy, gg.soulbound.optimus.server, r2dbc.spi, java.base, org.eclipse.jetty.client, java.security.sasl, java.management, com.fasterxml.jackson.module.paramnames, jcommander, org.eclipse.jetty.alpn.client, jdk.jlink, jdk.xml.dom, jdk.accessibility, jdk.jdeps, java.datatransfer, jdk.crypto.cryptoki, com.google.common, jdk.naming.dns, jdk.jstatd, org.eclipse.jetty.util, org.eclipse.jetty.http, java.logging, sentry, jdk.jdwp.agent, gg.soulbound.optimus.requirements, com.fasterxml.jackson.annotation, org.jooq, com.google.errorprone.annotations, jdk.sctp, jdk.jdi, java.naming, gg.soulbound.optimus.database, jdk.security.auth, com.fasterxml.jackson.datatype.jdk8, jdk.editpad, org.postgresql.jdbc, jdk.zipfs, jdk.jfr, org.flywaydb.core, java.xml, java.sql, org.eclipse.jetty.io, jfiglet, com.github.cowwoc.pouch.core, jdk.internal.le, org.slf4j, java.smartcardio, com.github.cowwoc.requirements.annotation, org.eclipse.jetty.http3.qpack, ch.qos.logback.classic, jdk.internal.jvmstat, jdk.jconsole, jdk.management.jfr, failureaccess, java.compiler, com.fasterxml.jackson.databind, listenablefuture, com.github.cowwoc.requirements.java, com.zaxxer.hikari, io.github.javadiffutils, java.transaction.xa, gg.soulbound.optimus.domain, jdk.nio.mapmode, jdk.crypto.ec, jdk.httpserver, java.scripting, jdk.jartool, gg.soulbound.optimus.common, java.security.jgss, jdk.security.jgss, jdk.dynalink, jdk.jsobject, jdk.naming.rmi, jquery, jdk.attach, sentry.jdbc, org.reactivestreams, jdk.internal.ed, jdk.unsupported.desktop, gg.soulbound.optimus.server.test, gg.soulbound.optimus.client]
      

      The thing to notice is that gson shows up when I run main() but is missing when I run unit tests.

      I will attach a copy of my pom.xml file and stdout when running unit tests. As far as I can see, Surefire is including the file in --module-path but it cannot be found at runtime.

      I tried toggling <useSystemClassloader> but it made no difference.

      Attachments

        1. surefire-20230823182041539_1tmp
          3 kB
          Gili
        2. surefire_0-20230823182041539_2tmp
          0.4 kB
          Gili
        3. surefireargs-20230823182041539_3
          8 kB
          Gili
        4. stdout.txt
          794 kB
          Gili
        5. pom.xml
          14 kB
          Gili

        Activity

          People

            Unassigned Unassigned
            cowwoc Gili
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: