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

Tibor Digana commented on SUREFIRE-1570:
----------------------------------------

Both, MP and CP, are discovered. You should have {{module-info.java}} in 
{{src/main/java}}. Do not bother with test dependencies in {{module-info.java}} 
because compile and runtime dependencies are discovered. The test artifacts go 
to CP but we have an ambition to discover test dependencies in SUREFIRE-1733 
and split them to CP and MP too.

If you want to provide a fix for this Jira issue, i can guide you where the fix 
should be applied. Simply the 
[getModuleDescriptor()|https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L1295]
 should be polymorphic and the behavior should be like that in 
{{SurefirePluginMojo}} but different in {{IntegrationTestMojo}}. Then you will 
see that the 
[descriptor|https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L1886]
 is used in order to split the path to CP and MP.
Your taks will be to substitute path to the descriptor of File with 
[ResolvePathResult|https://github.com/codehaus-plexus/plexus-languages/blob/master/plexus-java/src/main/java/org/codehaus/plexus/languages/java/jpms/LocationManager.java#L111-L118],
 see Robet's hint in his 
[comment|https://issues.apache.org/jira/browse/SUREFIRE-1570?focusedCommentId=16831071&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16831071].




> 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
>            Priority: Major
>             Fix For: 3.0.0-M5
>
>         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
(v8.3.4#803005)

Reply via email to