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

Allow to configure JVM for tests by referencing a toolchain entry

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-M5
    • None
    • None

    Description

      There is the property "jvm" which allows to specify a specific JVM to run on the tests through Surefire. This puts in an absolute path into my POM, though, which makes the build less portable.

      Therefore I propose to allow an alternative option which allows to refer to specific JDKs configured through toolchains.xml:

      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
              <toolchain>
                  <jdk>
                      <version>1.7</version>
                      <vendor>sun</vendor>
                  </jdk>
              </toolchains> 
          </configuration>
      </plugin>
      

      Note that this allows to use a specific toolchain just for tests, independently what's configured as toolchain for the overall build through the maven-toolchain-plugin. This e.g. allows to run the build on JDK 8 but run tests on JDK/JRE 7 (which is a frequent requirement for our projects). Or one could have several Surefire executions, running tests on different Java versions.

      The toolchain to use should be injectable through a property, so one can easily configure it, e.g. for specific Jenkins runs: "... -Dsurefire.toolchain=jdk:1.7" or "... -Dsurefire.toolchain=jdk:1.7:sun".

      Attachments

        Issue Links

          Activity

            People

              tibordigana Tibor Digana
              gunnar.morling Gunnar Morling
              Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: