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

mvn+java7 and POM with toolchains targeting java8 fail in surefire plugin

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.20.1
    • None
    • Maven Surefire Plugin
    • Maven 3.3.9 started with JDK 7
      (on Windows Server 2012)

    Description

      We compile and test with a POM using a toolchain configuration targeting JDK 8. Maven itself runs with JDK 7. If we run tests with the maven-surefire-plugin and forkCount=1 and reuseForks=false the build fails with
      java.lang.UnsupportedClassVersionError: SomeTestClass : Unsupported major.minor version 52.0
      If we set reuseForks=true, it builds fine. Other combinations seem to fail, if the plugin code running in the JDK 7 context presumably needs to use reflections to enumerate test classes.

      As newbies to toolchains, we were assuming, that toolchains enabled us to effectively decouple the JDK version used to run maven from the JDK version used to run the tests.

      This problem took us quite some time to solve. As an improvement I would suggest a meaningful warning or error message stating that the surefire plugin must be run with a JDK version higher than or equal to the version of the target JDK from the toolchain configuration.

      Attachments

        1. run-with-errors.txt
          97 kB
          Rüdiger Groß-Hardt
        2. surefire-1459.zip
          20 kB
          Rüdiger Groß-Hardt

        Activity

          People

            Unassigned Unassigned
            hardy_65 Rüdiger Groß-Hardt
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: