Author: rfscholte
Date: Wed Aug 10 19:14:09 2016
New Revision: 1755804
URL: http://svn.apache.org/viewvc?rev=1755804&view=rev
Log:
[MCOMPILER-270] Support release=8 on JDK 9 (with fallback on source=8 and
target=8 on JDK 8)
Added:
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/invoker.properties
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/pom.xml
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/main/
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/main/java/
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/main/java/MyClass.java
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/test/
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/test/java/
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/test/java/MyTest.java
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/verify.groovy
Modified:
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
Added:
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/invoker.properties
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/invoker.properties?rev=1755804&view=auto
==============================================================================
---
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/invoker.properties
(added)
+++
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/invoker.properties
Wed Aug 10 19:14:09 2016
@@ -0,0 +1,18 @@
+# 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.9+
Added:
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/pom.xml?rev=1755804&view=auto
==============================================================================
---
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/pom.xml
(added)
+++
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/pom.xml
Wed Aug 10 19:14:09 2016
@@ -0,0 +1,57 @@
+<?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>mcompiler270</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <url>https://issues.apache.org/jira/browse/MCOMPILER-270</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>6</release>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added:
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/main/java/MyClass.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/main/java/MyClass.java?rev=1755804&view=auto
==============================================================================
---
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/main/java/MyClass.java
(added)
+++
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/main/java/MyClass.java
Wed Aug 10 19:14:09 2016
@@ -0,0 +1,23 @@
+/*
+ * 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
+{
+
+}
Added:
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/test/java/MyTest.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/test/java/MyTest.java?rev=1755804&view=auto
==============================================================================
---
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/test/java/MyTest.java
(added)
+++
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/src/test/java/MyTest.java
Wed Aug 10 19:14:09 2016
@@ -0,0 +1,26 @@
+/*
+ * 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
+{
+
+}
Added:
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/verify.groovy
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/verify.groovy?rev=1755804&view=auto
==============================================================================
---
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/verify.groovy
(added)
+++
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-270_release/verify.groovy
Wed Aug 10 19:14:09 2016
@@ -0,0 +1,25 @@
+/*
+ * 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/ )
+
Modified:
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java?rev=1755804&r1=1755803&r2=1755804&view=diff
==============================================================================
---
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
(original)
+++
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
Wed Aug 10 19:14:09 2016
@@ -139,6 +139,14 @@ public abstract class AbstractCompilerMo
protected String target;
/**
+ * The -release argument for the Java compiler, supported since Java9
+ *
+ * @since 3.6
+ */
+ @Parameter( property = "maven.compiler.release" )
+ protected String release;
+
+ /**
* The -encoding argument for the Java compiler.
*
* @since 2.1
@@ -456,6 +464,8 @@ public abstract class AbstractCompilerMo
protected abstract String getTarget();
+ protected abstract String getRelease();
+
protected abstract String getCompilerArgument();
protected abstract Map<String, String> getCompilerArguments();
@@ -560,6 +570,8 @@ public abstract class AbstractCompilerMo
compilerConfiguration.setSourceVersion( getSource() );
compilerConfiguration.setTargetVersion( getTarget() );
+
+ compilerConfiguration.setReleaseVersion( getRelease() );
compilerConfiguration.setProc( proc );
Modified:
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java?rev=1755804&r1=1755803&r2=1755804&view=diff
==============================================================================
---
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
(original)
+++
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
Wed Aug 10 19:14:09 2016
@@ -187,6 +187,13 @@ public class CompilerMojo
{
return target;
}
+
+ @Override
+ protected String getRelease()
+ {
+ return release;
+ }
+
protected String getCompilerArgument()
{
Modified:
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java?rev=1755804&r1=1755803&r2=1755804&view=diff
==============================================================================
---
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
(original)
+++
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
Wed Aug 10 19:14:09 2016
@@ -100,6 +100,13 @@ public class TestCompilerMojo
@Parameter ( property = "maven.compiler.testTarget" )
private String testTarget;
+ /**
+ * the -release argument for the test Java compiler
+ *
+ * @since 3.6
+ */
+ @Parameter ( property = "maven.compiler.testRelease" )
+ private String testRelease;
/**
* <p>
@@ -222,6 +229,12 @@ public class TestCompilerMojo
{
return testTarget == null ? target : testTarget;
}
+
+ @Override
+ protected String getRelease()
+ {
+ return testRelease == null ? release : testRelease;
+ }
protected String getCompilerArgument()
{