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

baseDir system-property gets overridden by other builder threads if forking is disabled

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.19.1
    • 2.20
    • Maven Surefire Plugin
    • None

    Description

      When running tests in a multi-module project with multiple builder threads and surefire's forkCount set to 0, the threads override each other when setting the baseDir system-property.

      Running the sample project results in the below output with the given commands.
      (Note: First number is the expected path. e.g. 11 => wrapper1; module1)

      Correct

      mvn clean install | grep basedir
      01 basedir=<path>/maven-surefire-example/module1
      02 basedir=<path>/maven-surefire-example/module2
      03 basedir=<path>/maven-surefire-example/module3
      11 basedir=<path>/maven-surefire-example/wrapper1/module1
      12 basedir=<path>/maven-surefire-example/wrapper1/module2
      13 basedir=<path>/maven-surefire-example/wrapper1/module3
      21 basedir=<path>/maven-surefire-example/wrapper2/module1
      22 basedir=<path>/maven-surefire-example/wrapper2/module2
      23 basedir=<path>/maven-surefire-example/wrapper2/module3
      31 basedir=<path>/maven-surefire-example/wrapper3/module1
      32 basedir=<path>/maven-surefire-example/wrapper3/module2
      33 basedir=<path>/maven-surefire-example/wrapper3/module3
      

      Incorrect

      mvn clean install -T 3 | grep basedir
      02 basedir=<path>/maven-surefire-example/module2
      01 basedir=<path>/maven-surefire-example/module2
      03 basedir=<path>/maven-surefire-example/module2
      13 basedir=<path>/maven-surefire-example/wrapper1/module1
      23 basedir=<path>/maven-surefire-example/wrapper1/module1
      11 basedir=<path>/maven-surefire-example/wrapper1/module1
      12 basedir=<path>/maven-surefire-example/wrapper2/module2
      21 basedir=<path>/maven-surefire-example/wrapper2/module2
      22 basedir=<path>/maven-surefire-example/wrapper2/module2
      32 basedir=<path>/maven-surefire-example/wrapper3/module3
      31 basedir=<path>/maven-surefire-example/wrapper3/module3
      33 basedir=<path>/maven-surefire-example/wrapper3/module3
      

      This is correct behaviour from a technical point of view as the system-properties are shared between the threads and the surefire-executions (due to the disabled forking), therefore I opened this issue mainly for documentation purpose.

      This behaviour does not affect our current project anymore due to the removal of the forkCount setting, yet I think that this behaviour should be documented.

      Attachments

        Issue Links

          Activity

            People

              tibordigana Tibor Digana
              rraumberger Richard Raumberger
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: