You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Yoann Rodière (JIRA)" <ji...@apache.org> on 2019/04/01 13:43:00 UTC

[jira] [Commented] (SUREFIRE-1570) Maven-fail-safe doesn't put testing JPMS module on module path

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

Yoann Rodière commented on SUREFIRE-1570:
-----------------------------------------

I just experienced this bug, and investigated a little bit. Apparently the failsafe plugin never considers the modulepath, because it is unable to detect that a given JAR contains {{module-info.class}}.

See how the module descriptor is retrieved in {{org.apache.maven.plugin.surefire.AbstractSurefireMojo}}:

{code:java}
private File getModuleDescriptor()
{
    return new File( getClassesDirectory(), "module-info.class" );
}
{code}

For the failsafe plugin, {{getClassesDirectory()}} returns the path of the JAR, not the path of a directory. As a result, {{getModuleDescriptor().exists()}}, called in other methods on this file, ends up being always false, because {{File.exists()}} does not handle JAR/ZIP file traversal transparently.

> Maven-fail-safe doesn't put testing JPMS module on module path
> --------------------------------------------------------------
>
>                 Key: SUREFIRE-1570
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1570
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Failsafe Plugin
>    Affects Versions: 2.22.0
>            Reporter: Pavel_K
>            Assignee: Robert Scholte
>            Priority: Major
>         Attachments: mavenproject20.zip
>
>
> I uploaded project - mavenproject20. Run `mvn verify`. You will see the following:
> {code:java}
> [INFO] Scanning for projects...
> [INFO]                                                                         
> [INFO] ------------------------------------------------------------------------
> [INFO] Building mavenproject20 0.1.0-SNAPSHOT
> [INFO] ------------------------------------------------------------------------
> [INFO] 
> [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mavenproject20 ---
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] Copying 0 resource
> [INFO] 
> [INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ mavenproject20 ---
> [WARNING] ********************************************************************************************************************
> [WARNING] * Required filename-based automodules detected. Please don't publish this project to a public artifact repository! *
> [WARNING] ********************************************************************************************************************
> [INFO] Changes detected - recompiling the module!
> [INFO] Compiling 3 source files to /home/Jim/NetBeansProjects/mavenproject20/target/classes
> [WARNING] /home/Jim/NetBeansProjects/mavenproject20/src/main/java/module-info.java:[1,8] module name component Mavenproject20 should avoid terminal digits
> [INFO] 
> [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ mavenproject20 ---
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] skip non existing resourceDirectory /home/Jim/NetBeansProjects/mavenproject20/src/test/resources
> [INFO] 
> [INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ mavenproject20 ---
> [INFO] Changes detected - recompiling the module!
> [INFO] Compiling 1 source file to /home/Jim/NetBeansProjects/mavenproject20/target/test-classes
> [INFO] 
> [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ mavenproject20 ---
> [INFO] 
> [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ mavenproject20 ---
> [INFO] Building jar: /home/Jim/NetBeansProjects/mavenproject20/target/mavenproject20-0.1.0-SNAPSHOT.jar
> [INFO] 
> [INFO] --- maven-failsafe-plugin:2.22.0:integration-test (integration-tests) @ mavenproject20 ---
> [INFO] 
> [INFO] -------------------------------------------------------
> [INFO]  T E S T S
> [INFO] -------------------------------------------------------
> [INFO] Running me.pavel.mavenproject20.ServiceIT
> JDKModulePath:null
> ModuleName:null
> module jdk.unsupported
> module jdk.sctp
> module java.naming
> module java.jnlp
> module jdk.httpserver
> module java.xml
> module javafx.controls
> module java.datatransfer
> module jdk.javadoc
> module jdk.jconsole
> module java.instrument
> module jdk.packager
> module jdk.deploy
> module jdk.jfr
> module jdk.management
> module jdk.charsets
> module oracle.net
> module jdk.jdeps
> module java.sql.rowset
> module jdk.net
> module jdk.accessibility
> module jdk.attach
> module jdk.internal.le
> module jdk.snmp
> module java.base
> module jdk.plugin
> module jdk.dynalink
> module jdk.naming.rmi
> module jdk.internal.opt
> module java.management.rmi
> module jdk.management.jfr
> module javafx.swing
> module jdk.editpad
> module jdk.crypto.ec
> module jdk.javaws
> module jdk.jstatd
> module jdk.management.agent
> module javafx.graphics
> module javafx.media
> module java.rmi
> module java.prefs
> module jdk.security.jgss
> module javafx.fxml
> module java.smartcardio
> module jdk.xml.dom
> module java.xml.crypto
> module jdk.jsobject
> module jdk.jdi
> module jdk.compiler
> module java.management
> module jdk.management.cmm
> module jdk.packager.services
> module jdk.jartool
> module jdk.scripting.nashorn
> module java.security.jgss
> module jdk.localedata
> module java.desktop
> module jdk.zipfs
> module jdk.jshell
> module oracle.desktop
> module jdk.internal.ed
> module java.security.sasl
> module jdk.jdwp.agent
> module java.compiler
> module jdk.plugin.dom
> module javafx.web
> module jdk.naming.dns
> module jdk.crypto.cryptoki
> module jdk.management.resource
> module javafx.base
> module java.sql
> module jdk.security.auth
> module java.se
> module jdk.internal.jvmstat
> module jdk.jlink
> module java.logging
> module java.scripting
> [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.049 s <<< FAILURE! - in me.pavel.mavenproject20.ServiceIT
> [ERROR] testGetString  Time elapsed: 0.037 s  <<< ERROR!
> java.util.NoSuchElementException: No value present
> 	at me.pavel.mavenproject20.ServiceIT.testGetString(ServiceIT.java:16)
> [INFO] 
> [INFO] Results:
> [INFO] 
> [ERROR] Errors: 
> [ERROR]   ServiceIT.testGetString:16 » NoSuchElement No value present
> [INFO] 
> [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
> [INFO] 
> [INFO] 
> [INFO] --- maven-failsafe-plugin:2.22.0:verify (integration-tests) @ mavenproject20 ---
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 5.148 s
> [INFO] Finished at: 2018-09-15T19:20:44+03:00
> [INFO] Final Memory: 16M/54M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.22.0:verify (integration-tests) on project mavenproject20: There are test failures.
> [ERROR] 
> [ERROR] Please refer to /home/Jim/NetBeansProjects/mavenproject20/target/failsafe-reports for the individual test results.
> [ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
> [ERROR] -> [Help 1]
> [ERROR] 
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR] 
> [ERROR] For more information about the errors and possible solutions, please read the following articles:
> [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
> {code}
> As you see it shows that `JDKModulePath:null and ModuleName:null`. At the same time there is no Mavenproject20 in boot layer, although all other modules are present (I don't think that the plugin creates another layer). Because of this it is impossible to test JPMS services.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)