[maven-compiler-plugin] branch master updated: Make unit/integration tests Java 12 compatible

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[maven-compiler-plugin] branch master updated: Make unit/integration tests Java 12 compatible

rfscholte
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new d8bfa28  Make unit/integration tests Java 12 compatible
d8bfa28 is described below

commit d8bfa285145ff536e994d56adf9efcf80771c967
Author: rfscholte <[hidden email]>
AuthorDate: Tue Mar 12 20:17:04 2019 +0100

    Make unit/integration tests Java 12 compatible
---
 pom.xml                                            |  1 +
 src/it/MCOMPILER-157/annotation-user/pom.xml       |  2 -
 src/it/MCOMPILER-157/invoker.properties            |  3 +-
 src/it/MCOMPILER-157/pom.xml                       |  4 --
 .../annotation-user/pom.xml                        |  2 -
 .../MCOMPILER-203-processorpath/invoker.properties |  3 +-
 src/it/MCOMPILER-203-processorpath/pom.xml         |  4 --
 src/it/MCOMPILER-224/annotation-user/pom.xml       |  2 -
 src/it/MCOMPILER-224/invoker.properties            | 20 --------
 src/it/MCOMPILER-260_customArguments/pom.xml       |  2 -
 src/it/MCOMPILER-270_release/pom.xml               |  2 +-
 .../invoker.properties                             |  2 +-
 src/it/MCOMPILER-275_separate-moduleinfo/pom.xml   |  4 +-
 src/it/MCOMPILER-332_release10/invoker.properties  | 18 -------
 src/it/MCOMPILER-332_release10/pom.xml             | 57 ----------------------
 .../src/main/java/MyClass.java                     | 23 ---------
 .../src/test/java/MyTest.java                      | 26 ----------
 src/it/MCOMPILER-332_release10/verify.groovy       | 25 ----------
 src/it/error-prone-compiler/invoker.properties     |  2 +-
 src/it/jdk16-annotation/invoker.properties         | 22 ---------
 src/it/jdk16-annotation/pom.xml                    |  4 --
 src/it/mcompiler-120/pom.xml                       |  2 -
 src/it/mcompiler-135/invoker.properties            |  3 +-
 src/it/mcompiler-135/pom.xml                       | 10 ++--
 src/it/mcompiler-179/invoker.properties            |  3 +-
 src/it/mcompiler-179/pom.xml                       |  2 -
 .../singleproject-toolchains/invoker.properties    |  2 +-
 .../plugin/compiler/CompilerMojoTestCase.java      | 14 +++---
 28 files changed, 22 insertions(+), 242 deletions(-)

diff --git a/pom.xml b/pom.xml
index f3842b5..e9cfafa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -253,6 +253,7 @@ under the License.
             <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-invoker-plugin</artifactId>
+              <version>3.2.0</version>
               <executions>
                 <execution>
                   <id>integration-test</id>
diff --git a/src/it/MCOMPILER-157/annotation-user/pom.xml b/src/it/MCOMPILER-157/annotation-user/pom.xml
index 1bb8dde..3935615 100644
--- a/src/it/MCOMPILER-157/annotation-user/pom.xml
+++ b/src/it/MCOMPILER-157/annotation-user/pom.xml
@@ -52,8 +52,6 @@ under the License.
       <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
           <annotationProcessors>
             <annotationProcessor>org.issue.SimpleAnnotationProcessor</annotationProcessor>
           </annotationProcessors>
diff --git a/src/it/MCOMPILER-157/invoker.properties b/src/it/MCOMPILER-157/invoker.properties
index dbf1fd6..3533442 100644
--- a/src/it/MCOMPILER-157/invoker.properties
+++ b/src/it/MCOMPILER-157/invoker.properties
@@ -15,5 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 
-invoker.java.version = 1.6+
-invoker.goals=clean process-test-classes
+invoker.goals=process-test-classes
diff --git a/src/it/MCOMPILER-157/pom.xml b/src/it/MCOMPILER-157/pom.xml
index cca75cf..e5494e8 100644
--- a/src/it/MCOMPILER-157/pom.xml
+++ b/src/it/MCOMPILER-157/pom.xml
@@ -42,10 +42,6 @@ under the License.
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>@project.version@</version>
-          <configuration>
-            <source>1.6</source>
-            <target>1.6</target>
-          </configuration>
         </plugin>
       </plugins>
     </pluginManagement>
diff --git a/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml b/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml
index 117ac09..47d8138 100644
--- a/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml
+++ b/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml
@@ -50,8 +50,6 @@ under the License.
       <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
           <annotationProcessors>
             <annotationProcessor>org.issue.SimpleAnnotationProcessor</annotationProcessor>
           </annotationProcessors>
diff --git a/src/it/MCOMPILER-203-processorpath/invoker.properties b/src/it/MCOMPILER-203-processorpath/invoker.properties
index 3189dec..3a02433 100644
--- a/src/it/MCOMPILER-203-processorpath/invoker.properties
+++ b/src/it/MCOMPILER-203-processorpath/invoker.properties
@@ -15,6 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-invoker.java.version = 1.6+
-invoker.goals=clean process-test-classes
+invoker.goals=process-test-classes
 invoker.goals.2=process-test-classes
diff --git a/src/it/MCOMPILER-203-processorpath/pom.xml b/src/it/MCOMPILER-203-processorpath/pom.xml
index 520a1cd..350f032 100644
--- a/src/it/MCOMPILER-203-processorpath/pom.xml
+++ b/src/it/MCOMPILER-203-processorpath/pom.xml
@@ -42,10 +42,6 @@ under the License.
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>@project.version@</version>
-          <configuration>
-            <source>1.6</source>
-            <target>1.6</target>
-          </configuration>
         </plugin>
       </plugins>
     </pluginManagement>
diff --git a/src/it/MCOMPILER-224/annotation-user/pom.xml b/src/it/MCOMPILER-224/annotation-user/pom.xml
index bde68e5..34e8020 100644
--- a/src/it/MCOMPILER-224/annotation-user/pom.xml
+++ b/src/it/MCOMPILER-224/annotation-user/pom.xml
@@ -49,8 +49,6 @@ under the License.
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
           <showWarnings>true</showWarnings>
-          <source>1.6</source>
-          <target>1.6</target>
           <annotationProcessors>
             <annotationProcessor>org.issue.MCompiler224AnnotationProcessor</annotationProcessor>
           </annotationProcessors>
diff --git a/src/it/MCOMPILER-224/invoker.properties b/src/it/MCOMPILER-224/invoker.properties
deleted file mode 100644
index bd21a87..0000000
--- a/src/it/MCOMPILER-224/invoker.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-invoker.java.version = 1.6+
-# message with JDK6 is prepended by unexpected prefix, so quick workaround is to ignore JDK6...
-#invoker.java.version = 1.7+
diff --git a/src/it/MCOMPILER-260_customArguments/pom.xml b/src/it/MCOMPILER-260_customArguments/pom.xml
index 2fcc1c2..8877764 100644
--- a/src/it/MCOMPILER-260_customArguments/pom.xml
+++ b/src/it/MCOMPILER-260_customArguments/pom.xml
@@ -40,8 +40,6 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>@project.version@</version>
         <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
           <compilerArgs>
               <arg>-Xmaxwarns</arg>
               <arg>7</arg>
diff --git a/src/it/MCOMPILER-270_release/pom.xml b/src/it/MCOMPILER-270_release/pom.xml
index 021e33a..f30f3ce 100644
--- a/src/it/MCOMPILER-270_release/pom.xml
+++ b/src/it/MCOMPILER-270_release/pom.xml
@@ -48,7 +48,7 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>@project.version@</version>
         <configuration>
-          <release>6</release>
+          <release>${java.specification.version}</release>
         </configuration>
       </plugin>
     </plugins>
diff --git a/src/it/MCOMPILER-275_separate-moduleinfo/invoker.properties b/src/it/MCOMPILER-275_separate-moduleinfo/invoker.properties
index 9511718..e596763 100644
--- a/src/it/MCOMPILER-275_separate-moduleinfo/invoker.properties
+++ b/src/it/MCOMPILER-275_separate-moduleinfo/invoker.properties
@@ -15,4 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 
-invoker.java.version = 9+
+invoker.toolchain.jdk.version=9
diff --git a/src/it/MCOMPILER-275_separate-moduleinfo/pom.xml b/src/it/MCOMPILER-275_separate-moduleinfo/pom.xml
index ac5335e..330663e 100644
--- a/src/it/MCOMPILER-275_separate-moduleinfo/pom.xml
+++ b/src/it/MCOMPILER-275_separate-moduleinfo/pom.xml
@@ -69,8 +69,8 @@
                 <exclude>module-info.java</exclude>
               </excludes>
               <!-- ideally this would be 1.5, but with CI's it is hard to have a proper toolchains.xml in place -->
-              <source>1.6</source>
-              <target>1.6</target>
+              <source>8</source>
+              <target>8</target>
             </configuration>
           </execution>
         </executions>
diff --git a/src/it/MCOMPILER-332_release10/invoker.properties b/src/it/MCOMPILER-332_release10/invoker.properties
deleted file mode 100644
index f74d633..0000000
--- a/src/it/MCOMPILER-332_release10/invoker.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-invoker.java.version = 10+
diff --git a/src/it/MCOMPILER-332_release10/pom.xml b/src/it/MCOMPILER-332_release10/pom.xml
deleted file mode 100644
index e520e08..0000000
--- a/src/it/MCOMPILER-332_release10/pom.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one
-  ~ or more contributor license agreements.  See the NOTICE file
-  ~ distributed with this work for additional information
-  ~ regarding copyright ownership.  The ASF licenses this file
-  ~ to you under the Apache License, Version 2.0 (the
-  ~ "License"); you may not use this file except in compliance
-  ~ with the License.  You may obtain a copy of the License at
-  ~
-  ~   http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing,
-  ~ software distributed under the License is distributed on an
-  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  ~ KIND, either express or implied.  See the License for the
-  ~ specific language governing permissions and limitations
-  ~ under the License.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>org.apache.maven.plugins.compiler.it</groupId>
-  <artifactId>mcompiler332</artifactId>
-  <version>1.0-SNAPSHOT</version>
-
-  <url>https://issues.apache.org/jira/browse/MCOMPILER-332</url>
-
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>3.8.2</version>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>@project.version@</version>
-        <configuration>
-          <release>10</release>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>
diff --git a/src/it/MCOMPILER-332_release10/src/main/java/MyClass.java b/src/it/MCOMPILER-332_release10/src/main/java/MyClass.java
deleted file mode 100644
index 4945381..0000000
--- a/src/it/MCOMPILER-332_release10/src/main/java/MyClass.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-public class MyClass
-{
-
-}
diff --git a/src/it/MCOMPILER-332_release10/src/test/java/MyTest.java b/src/it/MCOMPILER-332_release10/src/test/java/MyTest.java
deleted file mode 100644
index 46ba41d..0000000
--- a/src/it/MCOMPILER-332_release10/src/test/java/MyTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import junit.framework.TestCase;
-
-public class MyTest
-    extends TestCase
-{
-
-}
diff --git a/src/it/MCOMPILER-332_release10/verify.groovy b/src/it/MCOMPILER-332_release10/verify.groovy
deleted file mode 100644
index 8db63f2..0000000
--- a/src/it/MCOMPILER-332_release10/verify.groovy
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-def log = new File( basedir, 'build.log').text
-
-assert log.count( " --release" ) == 2
-
-assert !( log =~  /\s-source\s/ )
-assert !( log =~  /\s-target\s/ )
-
diff --git a/src/it/error-prone-compiler/invoker.properties b/src/it/error-prone-compiler/invoker.properties
index f9010c3..a0e11e0 100644
--- a/src/it/error-prone-compiler/invoker.properties
+++ b/src/it/error-prone-compiler/invoker.properties
@@ -15,6 +15,6 @@
 # specific language governing permissions and limitations
 # under the License.
 
-invoker.java.version = 1.8+,!11
+invoker.java.version = 1.8+,!11,!12
 invoker.goals = clean compile
 invoker.buildResult = failure
diff --git a/src/it/jdk16-annotation/invoker.properties b/src/it/jdk16-annotation/invoker.properties
deleted file mode 100644
index 2998963..0000000
--- a/src/it/jdk16-annotation/invoker.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# build project if Jdk is 1.6+, only then annotations get processed.
-invoker.java.version = 1.6+
-
-# test requires MNG-3203 to work
-invoker.maven.version = 2.2.0+
diff --git a/src/it/jdk16-annotation/pom.xml b/src/it/jdk16-annotation/pom.xml
index 8ca5d6e..6a12ad7 100644
--- a/src/it/jdk16-annotation/pom.xml
+++ b/src/it/jdk16-annotation/pom.xml
@@ -40,10 +40,6 @@ under the License.
             </configuration>
           </execution>
         </executions>
-        <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
-        </configuration>
       </plugin>
     </plugins>
   </build>
diff --git a/src/it/mcompiler-120/pom.xml b/src/it/mcompiler-120/pom.xml
index a558049..215363a 100644
--- a/src/it/mcompiler-120/pom.xml
+++ b/src/it/mcompiler-120/pom.xml
@@ -47,8 +47,6 @@ under the License.
         <artifactId>maven-compiler-plugin</artifactId>
         <version>@project.version@</version>
         <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
           <verbose>true</verbose>
           <debug>true</debug>
           <optimize>true</optimize>
diff --git a/src/it/mcompiler-135/invoker.properties b/src/it/mcompiler-135/invoker.properties
index 4accce0..9bc4766 100644
--- a/src/it/mcompiler-135/invoker.properties
+++ b/src/it/mcompiler-135/invoker.properties
@@ -15,5 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 
-invoker.goals = clean compile
-invoker.java.version = 1.6+
+invoker.goals=compile
diff --git a/src/it/mcompiler-135/pom.xml b/src/it/mcompiler-135/pom.xml
index 4e4dd52..9f2b7c8 100644
--- a/src/it/mcompiler-135/pom.xml
+++ b/src/it/mcompiler-135/pom.xml
@@ -33,12 +33,10 @@ under the License.
         <version>@project.version@</version>
         <configuration>
           <fork>true</fork>
-          <source>1.6</source>
-          <target>1.6</target>
-            <compilerArguments>
-              <Averbose>true</Averbose>
-              <AaddResDir>src/main/webapp</AaddResDir>
-            </compilerArguments>
+          <compilerArguments>
+            <Averbose>true</Averbose>
+            <AaddResDir>src/main/webapp</AaddResDir>
+          </compilerArguments>
         </configuration>
       </plugin>
     </plugins>
diff --git a/src/it/mcompiler-179/invoker.properties b/src/it/mcompiler-179/invoker.properties
index 86f9130..a374f3c 100644
--- a/src/it/mcompiler-179/invoker.properties
+++ b/src/it/mcompiler-179/invoker.properties
@@ -15,6 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-invoker.goals = clean compile
+invoker.goals = compile
 invoker.buildResult = failure
-invoker.java.version = 1.6+
diff --git a/src/it/mcompiler-179/pom.xml b/src/it/mcompiler-179/pom.xml
index fe39cd9..bf3c474 100644
--- a/src/it/mcompiler-179/pom.xml
+++ b/src/it/mcompiler-179/pom.xml
@@ -38,8 +38,6 @@ under the License.
           <artifactId>maven-compiler-plugin</artifactId>
           <version>@project.version@</version>
           <configuration>
-            <source>1.6</source>
-            <target>1.6</target>
             <compilerArgument>-Xlint:all</compilerArgument>
             <compilerArguments>
               <Werror />
diff --git a/src/it/multirelease-patterns/singleproject-toolchains/invoker.properties b/src/it/multirelease-patterns/singleproject-toolchains/invoker.properties
index b87e56b..e0899b0 100644
--- a/src/it/multirelease-patterns/singleproject-toolchains/invoker.properties
+++ b/src/it/multirelease-patterns/singleproject-toolchains/invoker.properties
@@ -14,5 +14,5 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-invoker.java.version = 9+
 invoker.goals = verify -Pmulti-jar
+invoker.toolchain.jdk.version=9
diff --git a/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java b/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java
index 8ae1dc6..37a60ca 100644
--- a/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java
+++ b/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java
@@ -46,6 +46,7 @@ import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugin.testing.stubs.ArtifactStub;
 import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.languages.java.version.JavaVersion;
 
 public class CompilerMojoTestCase
     extends AbstractMojoTestCase
@@ -62,14 +63,13 @@ public class CompilerMojoTestCase
         super.setUp();
         
         String javaSpec = System.getProperty( "java.specification.version" );
-        // It is needed to set target/source to JDK 6 for JDK9 and JDK10
-        // cause this is the lowest version which is supported by those JDK's.
-        // The default source/target "5" is not supported anymore.
-        // See https://issues.apache.org/jira/browse/MCOMPILER-338
-        if ( "9".equals( javaSpec ) || "10".equals ( javaSpec ) )
+        // It is needed to set target/source to JDK 7 for JDK12+
+        // because this is the lowest version which is supported by those JDK's.
+        // The default source/target "6" is not supported anymore.
+        if ( JavaVersion.parse( javaSpec ).isAtLeast( "12" ) )
         {
-            source = "6";
-            target = "6";
+            source = "7";
+            target = "7";
         }
     }