Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1919

JUnit test discovery fails with reuseForks=false but works when reuseForks=true

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.0.0-M5
    • None
    • Maven Surefire Plugin
    • None

    Description

      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:

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

      Which results in

      [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]
      

      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?

      Attachments

        Activity

          People

            Unassigned Unassigned
            jamodd Jan Mosig
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: