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

Tibor Digana commented on SUREFIRE-1539:
----------------------------------------

I used your project on GH. If there is {{forkCount=1}} we can see this error as 
a modularity problem:

{noformat}
com.pholser.junit.quickcheck.internal.ReflectionException: 
java.lang.IllegalAccessException: class 
com.pholser.junit.quickcheck.internal.Reflection cannot access class 
fr.cla.wires.core.pbt.BooleanSignalsGenerator (in module fr.cla.wires.core) 
because module fr.cla.wires.core does not export fr.cla.wires.core.pbt to 
unnamed module @6b26e945
{noformat}

Pls investigate the last part: 
{{because module fr.cla.wires.core does not export fr.cla.wires.core.pbt to 
unnamed module}}

According this material you have to investigate your project modularity 
together with the {{@arg file}} because it is one complex staff. Feel free to 
ping me after you have found the root cause.

This is the args file how we executed your tests in forked JVM:
{noformat}
--module-path
D:\vcs\github\SUREFIRE-1539\wires-core\target\classes;D:\vcs\github\SUREFIRE-1539\wires-support\target\classes
--class-path
D:\.m2\repository\org\apache\maven\surefire\surefire-booter\3.0.0-M1\surefire-booter-3.0.0-M1.jar;D:\.m2\repository\org\apache\maven\surefire\surefire-api\3.0.0-M1\surefire-api-3.0.0-M1.jar;D:\.m2\repository\org\apache\maven\surefire\surefire-logger-api\3.0.0-M1\surefire-logger-api-3.0.0-M1.jar;D:\vcs\github\SUREFIRE-1539\wires-core\target\test-classes;D:\vcs\github\SUREFIRE-1539\wires-support\target\test-classes;D:\.m2\repository\junit\junit\4.12\junit-4.12.jar;D:\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\.m2\repository\org\assertj\assertj-core\3.8.0\assertj-core-3.8.0.jar;D:\.m2\repository\org\mockito\mockito-core\2.8.47\mockito-core-2.8.47.jar;D:\.m2\repository\org\objenesis\objenesis\2.5\objenesis-2.5.jar;D:\.m2\repository\com\pholser\junit-quickcheck-core\0.7\junit-quickcheck-core-0.7.jar;D:\.m2\repository\org\javaruntype\javaruntype\1.2\javaruntype-1.2.jar;D:\.m2\repository\org\antlr\antlr-runtime\3.1.2\antlr-runtime-3.1.2.jar;D:\.m2\repository\ognl\ognl\3.1.2\ognl-3.1.2.jar;D:\.m2\repository\javassist\javassist\3.11.0.GA\javassist-3.11.0.GA.jar;D:\.m2\repository\ru\vyarus\generics-resolver\2.0.1\generics-resolver-2.0.1.jar;D:\.m2\repository\com\pholser\junit-quickcheck-generators\0.7\junit-quickcheck-generators-0.7.jar;D:\.m2\repository\org\apache\maven\surefire\surefire-junit4\3.0.0-M1\surefire-junit4-3.0.0-M1.jar;D:\.m2\repository\org\apache\maven\surefire\common-java5\3.0.0-M1\common-java5-3.0.0-M1.jar;D:\.m2\repository\org\apache\maven\surefire\common-junit3\3.0.0-M1\common-junit3-3.0.0-M1.jar;D:\.m2\repository\org\apache\maven\surefire\common-junit4\3.0.0-M1\common-junit4-3.0.0-M1.jar;D:\.m2\repository\org\apache\maven\shared\maven-shared-utils\3.1.0\maven-shared-utils-3.1.0.jar
--patch-module
fr.cla.wires.core=D:\vcs\github\SUREFIRE-1539\wires-core\target\test-classes
--add-exports
fr.cla.wires.core/fr.cla.wires.core=ALL-UNNAMED
--add-exports
fr.cla.wires.core/fr.cla.wires.core.boxes.exampleusage.basic=ALL-UNNAMED
--add-exports
fr.cla.wires.core/fr.cla.wires.core.boxes.exampleusage.composite=ALL-UNNAMED
--add-exports
fr.cla.wires.core/fr.cla.wires.core.boxes.exampleusage.multipleinputs=ALL-UNNAMED
--add-exports
fr.cla.wires.core/fr.cla.wires.core.boxes.exampleusage.propertybasedtesting=ALL-UNNAMED
--add-exports
fr.cla.wires.core/fr.cla.wires.core.boxes.exampleusage.reentrant=ALL-UNNAMED
--add-modules
fr.cla.wires.core
--add-reads
fr.cla.wires.core=ALL-UNNAMED
org.apache.maven.surefire.booter.ForkedBooter
{noformat}

> Surefire causes Jigwaw runtime errors when forkCount > 0
> --------------------------------------------------------
>
>                 Key: SUREFIRE-1539
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1539
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.22.0
>            Reporter: foo bar
>            Priority: Major
>         Attachments: mvn-X-clean-install--forkCount0-OK.txt, 
> mvn-X-clean-install--noforkCount0-KO.txt
>
>
> h1. The problem
> I'm migrating my toy project to Jigsaw modules. 
>  Now I managed to make it work ({{maven clean install}} OK), but I had to 
> pass an additional flag to Surefire ({{forkCount=0}}) that I think I 
> shouldn't have to and feels very "magical" (in a bad way).
> To reproduce:
>      1. {{git clone [https://github.com/vandekeiser/wires.git]}}
>      2. {{git checkout REPORT_SUREFIRE}}
>      3.1 {{mvn clean install}}
>          -->passes
>      3.2 remove {{<forkCount>0</forkCount>}} in {{/pom.xml}}
>          -->fails
> h1. Analysis
> If I remove {{<forkCount>0</forkCount>}} or set it to 1 in {{/pom.xml}} I get:
> {code:java}
> [ERROR] Tests run: 5, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 5.678 
> s <<< FAILURE! - in 
> fr.cla.wires.core.boxes.exampleusage.propertybasedtesting.MultipleAnd_ReduceAndCollectShouldBeEquivalent_PbtTest
> [ERROR] 
> should_sometimes_give_false(fr.cla.wires.core.boxes.exampleusage.propertybasedtesting.MultipleAnd_ReduceAndCollectShouldBeEquivalent_PbtTest)
>   Time elapsed: 0.219 s  <<< ERROR!
> com.pholser.junit.quickcheck.internal.ReflectionException: 
> java.lang.IllegalAccessException: class 
> com.pholser.junit.quickcheck.internal.Reflection cannot access class 
> fr.cla.wires.core.support.tests.pbt.BooleansGenerator (in module 
> fr.cla.wires.core) because module fr.cla.wires.core does not export 
> fr.cla.wires.core.support.tests.pbt to unnamed module @4b5a5ed1
> {code}
> Looks like --add-opens is no longer added? Or is it just appended to the 
> command line, not added to the tmp java @arg file?
> Or is it that with forkCount=0 the test is ran on the classpath and with 
> forkCount=1 the test is ran on the modulepath?
>  
> If i set it to 2, I get instead:
> {code:java}
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-surefire-plugin:2.22.0:test (default-test) on 
> project wires-support: Execution default-test of goal 
> org.apache.maven.plugins:maven-surefire-plugin:2.22.0:test failed: 
> java.lang.ClassNotFoundException: 
> org.apache.maven.plugin.surefire.StartupReportConfiguration -> [Help 1]{code}
>  Which is even more mysterious.
> Environment:
> {code:java}
> $ mvn -version
> Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 
> 2018-06-17T20:33:14+02:00)
> Maven home: G:\software\apache-maven-3.5.4-bin\apache-maven-3.5.4
> Java version: 10.0.2, vendor: Oracle Corporation, runtime: C:\Program 
> Files\Java\jdk-10.0.2
> Default locale: fr_FR, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"{code}



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

Reply via email to