title: Java version issue with maven-surefire-plugin while running mvn test in Jenkins
body: <p>I tried building artifact in Jenkins with OpenJDK11. First I ran <code>mvn clean install -DskipTests</code> &amp; build was successful.</p>
  
  <p>But when I ran <code>mvn clean install</code>, I got following error for test classes.</p>
  
  <pre><code>&lt;CLASS_NAME&gt; has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
  
  
  org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
  &lt;CLASS_NAME&gt; has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
  </code></pre>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>&lt;properties&gt;
      &lt;java.version&gt;11&lt;/java.version&gt;
      &lt;maven.compiler.source&gt;11&lt;/maven.compiler.source&gt;
      &lt;maven.compiler.target&gt;11&lt;/maven.compiler.target&gt;
  &lt;/properties&gt; 
  &lt;plugins&gt;
      &lt;plugin&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.8.0&lt;/version&gt;
          &lt;configuration&gt;
              &lt;release&gt;11&lt;/release&gt;
              &lt;compilerId&gt;groovy-eclipse-compiler&lt;/compilerId&gt;
              &lt;compilerArguments&gt;
                  &lt;indy/&gt;
                  &lt;configScript&gt;config.groovy&lt;/configScript&gt;
              &lt;/compilerArguments&gt;
          &lt;/configuration&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.codehaus.groovy&lt;/groupId&gt;
                  &lt;artifactId&gt;groovy-eclipse-compiler&lt;/artifactId&gt;
                  &lt;version&gt;3.0.0-01&lt;/version&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.codehaus.groovy&lt;/groupId&gt;
                  &lt;artifactId&gt;groovy-eclipse-batch&lt;/artifactId&gt;
                  &lt;version&gt;2.5.5-01&lt;/version&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.22.1&lt;/version&gt;
          &lt;configuration&gt;
              &lt;includes&gt;
                  &lt;include&gt;**/*Spec.*&lt;/include&gt;
              &lt;/includes&gt;
          &lt;/configuration&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  </code></pre>
  
  <p>Please help me in fixing this issue in Jenkins</p>
  
  <p><strong>Note</strong>: I faced similar issue in my local also. I changed JAVA_HOME in <strong>~/.mavenrc</strong> file &amp; the issue got resolved</p>