[ https://issues.apache.org/jira/browse/SUREFIRE-1919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17631359#comment-17631359 ]
Andrew Orlowski commented on SUREFIRE-1919: ------------------------------------------- Jan's comment above is not accurate. You may be able to resolve it using MAVEN_OPTS, but the issue is not that "the argline cannot be passed" or whatever. I am not even sure that "the tests run directly in the mvn JVM" is true, although I am inclined to say it's not. It's a versioning issue of junit-jupiter. See https://github.com/junit-team/junit5/issues/1579 > JUnit test discovery fails with reuseForks=false but works when > reuseForks=true > ------------------------------------------------------------------------------- > > Key: SUREFIRE-1919 > URL: https://issues.apache.org/jira/browse/SUREFIRE-1919 > Project: Maven Surefire > Issue Type: Bug > Components: Maven Surefire Plugin > Affects Versions: 3.0.0-M5 > Environment: * java version "16.0.1" 2021-04-20 > * Java(TM) SE Runtime Environment (build 16.0.1+9-24) > * Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing) > * Microsoft Windows [Version 10.0.19043.1052] > * Maven 3.6.3 > * Surefire 3.0.0-M5 > * JUnit (Jupiter) 5.7.2 > Reporter: Jan Mosig > Priority: Major > > Hi there, > the other day I was playing around with incubator code from JDK16 and noticed > odd behavior wrt the reuseForks configuration. > > In order to compile and run tests, my project needs the jdk.incubator.foreign > module. So I configured it like this: > {code:java} > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-surefire-plugin</artifactId> > <configuration> > <reuseForks>false</reuseForks> > <forkCount>1</forkCount> > <argLine>-Dforeign.restricted=permit > --add-modules=jdk.incubator.foreign</argLine> > </configuration> > </plugin> > {code} > Which results in > {code} > [ERROR] Failed to execute goal > org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) > on project de.itemis.mosig.sfrf: Execution default-test of goal > org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test failed: > org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' > failed to discover tests: ClassSelector [className = > 'de.itemis.mosig.sfrf.AppTest'] resolution failed: > jdk/incubator/foreign/MemoryLayout: jdk.incubator.foreign.MemoryLayout -> > [Help 1] > {code} > Whereas setting {{reuseForks}} to {{true}} works. > Please note that the project itself is not modularized, i. e. it does not > have a module-info.java specification (on purpose). > I provided a demo for this over at GitHub: > https://github.com/JanMosigItemis/sfrf > Any thoughts? -- This message was sent by Atlassian Jira (v8.20.10#820010)