You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jan Mosig (Jira)" <ji...@apache.org> on 2021/06/13 18:22:00 UTC

[jira] [Created] (SUREFIRE-1919) JUnit test discovery fails with reuseForks=false but works when reuseForks=true

Jan Mosig created SUREFIRE-1919:
-----------------------------------

             Summary: 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


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.3.4#803005)