From d8bfa285145ff536e994d56adf9efcf80771c967 Mon Sep 17 00:00:00 2001 From: rfscholte Date: Tue, 12 Mar 2019 20:17:04 +0100 Subject: [PATCH] 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 - .../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 +- .../MCOMPILER-275_separate-moduleinfo/pom.xml | 4 +- .../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 -------- .../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 - .../invoker.properties | 2 +- .../plugin/compiler/CompilerMojoTestCase.java | 14 ++--- 28 files changed, 22 insertions(+), 242 deletions(-) delete mode 100644 src/it/MCOMPILER-224/invoker.properties delete mode 100644 src/it/MCOMPILER-332_release10/invoker.properties delete mode 100644 src/it/MCOMPILER-332_release10/pom.xml delete mode 100644 src/it/MCOMPILER-332_release10/src/main/java/MyClass.java delete mode 100644 src/it/MCOMPILER-332_release10/src/test/java/MyTest.java delete mode 100644 src/it/MCOMPILER-332_release10/verify.groovy delete mode 100644 src/it/jdk16-annotation/invoker.properties diff --git a/pom.xml b/pom.xml index f3842b5b..e9cfafa1 100644 --- a/pom.xml +++ b/pom.xml @@ -253,6 +253,7 @@ under the License. org.apache.maven.plugins maven-invoker-plugin + 3.2.0 integration-test diff --git a/src/it/MCOMPILER-157/annotation-user/pom.xml b/src/it/MCOMPILER-157/annotation-user/pom.xml index 1bb8ddea..3935615c 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. maven-compiler-plugin - 1.6 - 1.6 org.issue.SimpleAnnotationProcessor diff --git a/src/it/MCOMPILER-157/invoker.properties b/src/it/MCOMPILER-157/invoker.properties index dbf1fd65..3533442e 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 cca75cf2..e5494e86 100644 --- a/src/it/MCOMPILER-157/pom.xml +++ b/src/it/MCOMPILER-157/pom.xml @@ -42,10 +42,6 @@ under the License. org.apache.maven.plugins maven-compiler-plugin @project.version@ - - 1.6 - 1.6 - diff --git a/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml b/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml index 117ac09d..47d81386 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. maven-compiler-plugin - 1.6 - 1.6 org.issue.SimpleAnnotationProcessor diff --git a/src/it/MCOMPILER-203-processorpath/invoker.properties b/src/it/MCOMPILER-203-processorpath/invoker.properties index 3189deca..3a024336 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 520a1cd3..350f0327 100644 --- a/src/it/MCOMPILER-203-processorpath/pom.xml +++ b/src/it/MCOMPILER-203-processorpath/pom.xml @@ -42,10 +42,6 @@ under the License. org.apache.maven.plugins maven-compiler-plugin @project.version@ - - 1.6 - 1.6 - diff --git a/src/it/MCOMPILER-224/annotation-user/pom.xml b/src/it/MCOMPILER-224/annotation-user/pom.xml index bde68e5d..34e80206 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. maven-compiler-plugin true - 1.6 - 1.6 org.issue.MCompiler224AnnotationProcessor diff --git a/src/it/MCOMPILER-224/invoker.properties b/src/it/MCOMPILER-224/invoker.properties deleted file mode 100644 index bd21a871..00000000 --- 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 2fcc1c26..8877764b 100644 --- a/src/it/MCOMPILER-260_customArguments/pom.xml +++ b/src/it/MCOMPILER-260_customArguments/pom.xml @@ -40,8 +40,6 @@ maven-compiler-plugin @project.version@ - 1.6 - 1.6 -Xmaxwarns 7 diff --git a/src/it/MCOMPILER-270_release/pom.xml b/src/it/MCOMPILER-270_release/pom.xml index 021e33a5..f30f3cef 100644 --- a/src/it/MCOMPILER-270_release/pom.xml +++ b/src/it/MCOMPILER-270_release/pom.xml @@ -48,7 +48,7 @@ maven-compiler-plugin @project.version@ - 6 + ${java.specification.version} diff --git a/src/it/MCOMPILER-275_separate-moduleinfo/invoker.properties b/src/it/MCOMPILER-275_separate-moduleinfo/invoker.properties index 95117185..e596763a 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 ac5335e6..330663e5 100644 --- a/src/it/MCOMPILER-275_separate-moduleinfo/pom.xml +++ b/src/it/MCOMPILER-275_separate-moduleinfo/pom.xml @@ -69,8 +69,8 @@ module-info.java - 1.6 - 1.6 + 8 + 8 diff --git a/src/it/MCOMPILER-332_release10/invoker.properties b/src/it/MCOMPILER-332_release10/invoker.properties deleted file mode 100644 index f74d633b..00000000 --- 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 e520e089..00000000 --- a/src/it/MCOMPILER-332_release10/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - 4.0.0 - - org.apache.maven.plugins.compiler.it - mcompiler332 - 1.0-SNAPSHOT - - https://issues.apache.org/jira/browse/MCOMPILER-332 - - - UTF-8 - - - - - junit - junit - 3.8.2 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - @project.version@ - - 10 - - - - - - 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 4945381a..00000000 --- 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 46ba41d4..00000000 --- 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 8db63f20..00000000 --- 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 f9010c3b..a0e11e06 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 29989637..00000000 --- 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 8ca5d6ef..6a12ad71 100644 --- a/src/it/jdk16-annotation/pom.xml +++ b/src/it/jdk16-annotation/pom.xml @@ -40,10 +40,6 @@ under the License. - - 1.6 - 1.6 - diff --git a/src/it/mcompiler-120/pom.xml b/src/it/mcompiler-120/pom.xml index a5580492..215363a4 100644 --- a/src/it/mcompiler-120/pom.xml +++ b/src/it/mcompiler-120/pom.xml @@ -47,8 +47,6 @@ under the License. maven-compiler-plugin @project.version@ - 1.6 - 1.6 true true true diff --git a/src/it/mcompiler-135/invoker.properties b/src/it/mcompiler-135/invoker.properties index 4accce0e..9bc47664 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 4e4dd521..9f2b7c87 100644 --- a/src/it/mcompiler-135/pom.xml +++ b/src/it/mcompiler-135/pom.xml @@ -33,12 +33,10 @@ under the License. @project.version@ true - 1.6 - 1.6 - - true - src/main/webapp - + + true + src/main/webapp + diff --git a/src/it/mcompiler-179/invoker.properties b/src/it/mcompiler-179/invoker.properties index 86f9130c..a374f3ce 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 fe39cd9e..bf3c4744 100644 --- a/src/it/mcompiler-179/pom.xml +++ b/src/it/mcompiler-179/pom.xml @@ -38,8 +38,6 @@ under the License. maven-compiler-plugin @project.version@ - 1.6 - 1.6 -Xlint:all diff --git a/src/it/multirelease-patterns/singleproject-toolchains/invoker.properties b/src/it/multirelease-patterns/singleproject-toolchains/invoker.properties index b87e56ba..e0899b04 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 8ae1dc60..37a60ca5 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.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 @@ protected void setUp() 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"; } }