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

Tibor Digana commented on SUREFIRE-1262:
----------------------------------------

You'r right, i haven't noticed {{Automatic-Module-Name}} in the manifest file.
I have used your project, executed the build with debug logs and I see the 
automatic module {{javax.persistence-api-2.2.jar}} on the module path. This is 
how the JVM is started using the args file:

{noformat}
[DEBUG] Forking command line: cmd.exe /X /C ""c:\Program 
Files\Java\jdk-11.0.2\bin\java" 
@C:\Users\tibor17\AppData\Local\Temp\surefire14795135659805170703\surefireargs10392419846920729243
 C:\Users\tibor17\AppData\Local\Temp\surefire14795135659805170703 
2020-04-23T12-17-51_047-jvmRun1 surefire9803582385134592733tmp 
surefire_03356188385539628095tmp"
{noformat}

and this is the content in the args file:

{noformat}
[DEBUG] Path to args file: 
C:\Users\tibor17\AppData\Local\Temp\surefire14795135659805170703\surefireargs10392419846920729243
[DEBUG] args file content:
--module-path
"C:\\vcs\\github\\surefire-jpms\\com.foo.plugin\\target\\classes;c:\\Users\\tibor17\\.m2\\repository\\org\\slf4j\\slf4j-simple\\1.8.0-beta2\\slf4j-simple-1.8.0-beta2.jar;C:\\vcs\\github\\surefire-jpms\\com.foo.api\\target\\classes;c:\\Users\\tibor17\\.m2\\repository\\javax\\persistence\\javax.persistence-api\\2.2\\javax.persistence-api-2.2.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\slf4j\\slf4j-api\\1.8.0-beta2\\slf4j-api-1.8.0-beta2.jar"
--class-path
"c:\\Users\\tibor17\\.m2\\repository\\org\\apache\\maven\\surefire\\surefire-booter\\3.0.0-M4\\surefire-booter-3.0.0-M4.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\apache\\maven\\surefire\\surefire-api\\3.0.0-M4\\surefire-api-3.0.0-M4.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\apache\\maven\\surefire\\surefire-logger-api\\3.0.0-M4\\surefire-logger-api-3.0.0-M4.jar;C:\\vcs\\github\\surefire-jpms\\com.foo.plugin\\target\\test-classes;c:\\Users\\tibor17\\.m2\\repository\\org\\junit\\jupiter\\junit-jupiter-engine\\5.5.2\\junit-jupiter-engine-5.5.2.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\apiguardian\\apiguardian-api\\1.1.0\\apiguardian-api-1.1.0.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\junit\\platform\\junit-platform-engine\\1.5.2\\junit-platform-engine-1.5.2.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\opentest4j\\opentest4j\\1.2.0\\opentest4j-1.2.0.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\junit\\platform\\junit-platform-commons\\1.5.2\\junit-platform-commons-1.5.2.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\junit\\jupiter\\junit-jupiter-api\\5.5.2\\junit-jupiter-api-5.5.2.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\junit\\platform\\junit-platform-runner\\1.5.2\\junit-platform-runner-1.5.2.jar;c:\\Users\\tibor17\\.m2\\repository\\junit\\junit\\4.12\\junit-4.12.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\hamcrest\\hamcrest-core\\1.3\\hamcrest-core-1.3.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\junit\\platform\\junit-platform-launcher\\1.5.2\\junit-platform-launcher-1.5.2.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\junit\\platform\\junit-platform-suite-api\\1.5.2\\junit-platform-suite-api-1.5.2.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\hamcrest\\hamcrest-all\\1.3\\hamcrest-all-1.3.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\apache\\maven\\surefire\\surefire-junit-platform\\3.0.0-M4\\surefire-junit-platform-3.0.0-M4.jar;c:\\Users\\tibor17\\.m2\\repository\\org\\apache\\maven\\surefire\\common-java5\\3.0.0-M4\\common-java5-3.0.0-M4.jar"
--patch-module
com.foo.plugin="C:\\vcs\\github\\surefire-jpms\\com.foo.plugin\\target\\test-classes"
--add-exports
com.foo.plugin/com.foo.plugin=ALL-UNNAMED
--add-modules
com.foo.plugin
--add-reads
com.foo.plugin=ALL-UNNAMED
org.apache.maven.surefire.booter.ForkedBooter
{noformat}




> Add modulepath support
> ----------------------
>
>                 Key: SUREFIRE-1262
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1262
>             Project: Maven Surefire
>          Issue Type: Improvement
>            Reporter: Robert Scholte
>            Assignee: Tibor Digana
>            Priority: Major
>             Fix For: 2.21.0
>
>
> With the Jigsaw project Java9 is extended with a modulepath. This means that 
> surefire should be executed in a different way.
> When working with a modulepath, the Classpath in the MANIFEST of the 
> executable jar will be ignored, you need need to add everything on 
> commandline. 
> Just like javadoc, the java executable has an {{@<file>}} option, where you 
> can add arguments per line. So this is the new preferred way to build the 
> module-path.
> IIUC for surefire it is important to add {{--patch-module 
> target/test-classes}} (was: -Xpatch) which makes it possible to use the same 
> packages as target/classes.



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

Reply via email to