You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tibor Digana (Jira)" <ji...@apache.org> on 2021/03/27 22:31:00 UTC

[jira] [Comment Edited] (SUREFIRE-1897) Incorrect classpath due to JPMS magic

    [ https://issues.apache.org/jira/browse/SUREFIRE-1897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17310087#comment-17310087 ] 

Tibor Digana edited comment on SUREFIRE-1897 at 3/27/21, 10:30 PM:
-------------------------------------------------------------------

[~hohwille]
oh no, the ITs are written in the module {{surefire-its}}.
As an example see this class {{ConsoleOutputIT}}.
The principle is so that the IT triggers a subprocess which is a pure Maven build (e.g. command {{mvn test}}).
The command is built using a fluent design, example:

{code:java}
        OutputValidator outputValidator = unpack()
                .forkOnce()
                .argLine( "-Dfile.encoding=UTF-16" )
                .executeTest();
{code}

The POM and sources as well as a directory where the project (for the subprocess) resides is determined by the method {{unpack()}}. You can see the directory name in {{surefire-its/src/test/resources/}}.


was (Author: tibor17):
[~hohwille]
oh no, the ITs are written in the module {{surefire-its}}.
As an example see this class {{ConsoleOutputIT}}.
The principle is so that the IT runs triggers a subprocess which is a pure Maven build (e.g. command {{mvn test}}).
The command is built using a fluent design, example:

{code:java}
        OutputValidator outputValidator = unpack()
                .forkOnce()
                .argLine( "-Dfile.encoding=UTF-16" )
                .executeTest();
{code}

The POM and sources as well as a directory where the project (for the subprocess) resides is determined by the method {{unpack()}}. You can see the directory name in {{surefire-its/src/test/resources/}}.

> Incorrect classpath due to JPMS magic
> -------------------------------------
>
>                 Key: SUREFIRE-1897
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1897
>             Project: Maven Surefire
>          Issue Type: Bug
>            Reporter: Jörg Hohwiller
>            Assignee: Tibor Digana
>            Priority: Major
>
> I converted my project to use CI friendly maven:
> [https://maven.apache.org/maven-ci-friendly.html]
> To fully simplify and get around bugs in M2E (maven eclipse plugin) I went away maintaining the version in .mvn/maven.config and simply set "revision" to "0-SNAPSHOT" in my parent POMs. When I build a release, I can override the "revision" to the actual release version.
> As a result now maven fails if I change the version of a sibling project I maintain and use to "0-SNAPSHOT" while the content of the code in the JARs has not changed at all.
> In the maven log I observed this warnings:
> {code:java}
> [WARNING] Can't extract module name from mmm-l10n-en-0-SNAPSHOT.jar: mmm.l10n.en.0.SNAPSHOT: Invalid module name: '0' is not a Java identifier
> [WARNING] Can't extract module name from mmm-l10n-de-0-SNAPSHOT.jar: mmm.l10n.de.0.SNAPSHOT: Invalid module name: '0' is not a Java identifier
> [WARNING] Can't extract module name from mmm-l10n-es-0-SNAPSHOT.jar: mmm.l10n.es.0.SNAPSHOT: Invalid module name: '0' is not a Java identifier
> [WARNING] Can't extract module name from mmm-l10n-fr-0-SNAPSHOT.jar: mmm.l10n.fr.0.SNAPSHOT: Invalid module name: '0' is not a Java identifier
> [WARNING] Can't extract module name from mmm-l10n-all-0-SNAPSHOT.jar: mmm.l10n.all.0.SNAPSHOT: Invalid module name: '0' is not a Java identifier{code}
> I launched the maven build with debugging (-X) both with the previous version 0.2.1-SNAPSHOT (working) and with 0-SNAPSHOT (failing). Here are the surefireargs for both variants:
> WORKING (0.2.1-SNAPSHOT dependency):
> {code:java}
> --module-path
> /Users/hohwille/projects/mmm/workspaces/main/nls/core/target/classes
> :/Users/hohwille/.m2/repository/io/github/m-m-m/mmm-scanner/0.2.1-SNAPSHOT/mmm-scanner-0.2.1-SNAPSHOT.jar
> :/Users/hohwille/.m2/repository/io/github/m-m-m/mmm-base/0.2.1-SNAPSHOT/mmm-base-0.2.1-SNAPSHOT.jar
> :/Users/hohwille/.m2/repository/org/slf4j/slf4j-api/2.0.0-alpha1/slf4j-api-2.0.0-alpha1.jar
> --class-path
> /Users/hohwille/.m2/repository/org/apache/maven/surefire/surefire-booter/2.22.2/surefire-booter-2.22.2.jar
> :/Users/hohwille/.m2/repository/org/apache/maven/surefire/surefire-api/2.22.2/surefire-api-2.22.2.jar
> :/Users/hohwille/.m2/repository/org/apache/maven/surefire/surefire-logger-api/2.22.2/surefire-logger-api-2.22.2.jar
> :/Users/hohwille/projects/mmm/workspaces/main/nls/core/target/test-classes:/Users/hohwille/.m2/repository/io/github/m-m-m/mmm-l10n-all/0.2.1-SNAPSHOT/mmm-l10n-all-0.2.1-SNAPSHOT.jar
> :/Users/hohwille/.m2/repository/io/github/m-m-m/mmm-l10n-de/0.2.1-SNAPSHOT/mmm-l10n-de-0.2.1-SNAPSHOT.jar
> :/Users/hohwille/.m2/repository/io/github/m-m-m/mmm-l10n-en/0.2.1-SNAPSHOT/mmm-l10n-en-0.2.1-SNAPSHOT.jar
> :/Users/hohwille/.m2/repository/io/github/m-m-m/mmm-l10n-es/0.2.1-SNAPSHOT/mmm-l10n-es-0.2.1-SNAPSHOT.jar
> :/Users/hohwille/.m2/repository/io/github/m-m-m/mmm-l10n-fr/0.2.1-SNAPSHOT/mmm-l10n-fr-0.2.1-SNAPSHOT.jar
> :/Users/hohwille/.m2/repository/org/junit/jupiter/junit-jupiter/5.7.0/junit-jupiter-5.7.0.jar
> :/Users/hohwille/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar
> :/Users/hohwille/.m2/repository/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar
> :/Users/hohwille/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar
> :/Users/hohwille/.m2/repository/org/junit/platform/junit-platform-commons/1.7.0/junit-platform-commons-1.7.0.jar
> :/Users/hohwille/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.7.0/junit-jupiter-params-5.7.0.jar
> :/Users/hohwille/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.7.0/junit-jupiter-engine-5.7.0.jar
> :/Users/hohwille/.m2/repository/org/junit/platform/junit-platform-engine/1.7.0/junit-platform-engine-1.7.0.jar
> :/Users/hohwille/.m2/repository/org/assertj/assertj-core/3.19.0/assertj-core-3.19.0.jar
> :/Users/hohwille/.m2/repository/ch/qos/logback/logback-classic/1.3.0-alpha5/logback-classic-1.3.0-alpha5.jar
> :/Users/hohwille/.m2/repository/ch/qos/logback/logback-core/1.3.0-alpha5/logback-core-1.3.0-alpha5.jar
> :/Users/hohwille/.m2/repository/com/sun/mail/javax.mail/1.6.2/javax.mail-1.6.2.jar
> :/Users/hohwille/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar
> :/Users/hohwille/.m2/repository/edu/washington/cs/types/checker/checker-framework/1.7.0/checker-framework-1.7.0.jar
> :/Users/hohwille/.m2/repository/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.jar
> :/Users/hohwille/.m2/repository/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.jar
> --patch-module
> io.github.mmm.nls=/Users/hohwille/projects/mmm/workspaces/main/nls/core/target/test-classes
> --add-exports
> io.github.mmm.nls/io.github.mmm.nls=ALL-UNNAMED
> --add-modules
> io.github.mmm.nls
> --add-reads
> io.github.mmm.nls=ALL-UNNAMED
> org.apache.maven.surefire.booter.ForkedBooter {code}
> FAILING (0-SNAPSHOT):
> {code:java}
> --module-path
> /Users/hohwille/projects/mmm/workspaces/main/nls/core/target/classes
> :/Users/hohwille/.m2/repository/io/github/m-m-m/mmm-scanner/0-SNAPSHOT/mmm-scanner-0-SNAPSHOT.jar
> :/Users/hohwille/.m2/repository/io/github/m-m-m/mmm-base/0-SNAPSHOT/mmm-base-0-SNAPSHOT.jar
> :/Users/hohwille/.m2/repository/org/slf4j/slf4j-api/2.0.0-alpha1/slf4j-api-2.0.0-alpha1.jar
> --class-path
> /Users/hohwille/.m2/repository/org/apache/maven/surefire/surefire-booter/2.22.2/surefire-booter-2.22.2.jar
> :/Users/hohwille/.m2/repository/org/apache/maven/surefire/surefire-api/2.22.2/surefire-api-2.22.2.jar
> :/Users/hohwille/.m2/repository/org/apache/maven/surefire/surefire-logger-api/2.22.2/surefire-logger-api-2.22.2.jar
> :/Users/hohwille/projects/mmm/workspaces/main/nls/core/target/test-classes
> :/Users/hohwille/.m2/repository/org/junit/jupiter/junit-jupiter/5.7.0/junit-jupiter-5.7.0.jar
> :/Users/hohwille/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar
> :/Users/hohwille/.m2/repository/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar
> :/Users/hohwille/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar
> :/Users/hohwille/.m2/repository/org/junit/platform/junit-platform-commons/1.7.0/junit-platform-commons-1.7.0.jar
> :/Users/hohwille/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.7.0/junit-jupiter-params-5.7.0.jar
> :/Users/hohwille/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.7.0/junit-jupiter-engine-5.7.0.jar
> :/Users/hohwille/.m2/repository/org/junit/platform/junit-platform-engine/1.7.0/junit-platform-engine-1.7.0.jar
> :/Users/hohwille/.m2/repository/org/assertj/assertj-core/3.19.0/assertj-core-3.19.0.jar
> :/Users/hohwille/.m2/repository/ch/qos/logback/logback-classic/1.3.0-alpha5/logback-classic-1.3.0-alpha5.jar
> :/Users/hohwille/.m2/repository/ch/qos/logback/logback-core/1.3.0-alpha5/logback-core-1.3.0-alpha5.jar
> :/Users/hohwille/.m2/repository/com/sun/mail/javax.mail/1.6.2/javax.mail-1.6.2.jar
> :/Users/hohwille/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar
> :/Users/hohwille/.m2/repository/edu/washington/cs/types/checker/checker-framework/1.7.0/checker-framework-1.7.0.jar
> :/Users/hohwille/.m2/repository/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.jar
> :/Users/hohwille/.m2/repository/org/junit/platform/junit-platform-launcher/1.3.1/junit-platform-launcher-1.3.1.jar
> --patch-module
> io.github.mmm.nls=/Users/hohwille/projects/mmm/workspaces/main/nls/core/target/test-classes
> --add-exports
> io.github.mmm.nls/io.github.mmm.nls=ALL-UNNAMED
> --add-modules
> io.github.mmm.nls
> --add-reads
> io.github.mmm.nls=ALL-UNNAMED
> org.apache.maven.surefire.booter.ForkedBooter {code}
> So as you can see the surefire classpath is incorrect in the second case and simply omits the required test dependencies "mmm-l10n-*".
> As the warnings seem to be related to the bug but seem to originate from the maven compiler plugin I am not sure if this is surefire or a compiler plugin bug and filed it as general MNG issue.
> My project is OSS so you can find all here and reproduce:
> BROKEN:
>  * Code: [https://github.com/m-m-m/nls/tree/191a382d368bc2b579c184ec021ae7a94e7c915e]
>  * Travis error: [https://travis-ci.com/github/m-m-m/nls/builds/220787763]
> FIXED (temporary workaround):
>  * Code: [https://github.com/m-m-m/nls/tree/56e57ae490190a9b3824443d525e9e0dd4ef60fa]
>  * Travis success: [https://travis-ci.com/github/m-m-m/nls/builds/220788450]
> I am using maven-compiler-plugin 3.8.1:
> [https://github.com/m-m-m/parent/blob/2ba9d23f35792f8fcf528b1e7b94c05ff5656fa1/pom.xml#L31]
> and surefire 2.22.2:
> [https://github.com/m-m-m/parent/blob/2ba9d23f35792f8fcf528b1e7b94c05ff5656fa1/pom.xml#L44]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)