You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2019/03/23 12:37:25 UTC
[maven-compiler-plugin] 01/01: [MCOMPILER 366] - Warning about
automodules should provide the list of offending libraries - Collected
filename based automodules detected and added to the log message. - Updated
unit tests accordingly. - Added new integration test with 2 modules. - Make
unit/integration tests Java 12 compatible
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch MCOMPILER-366
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git
commit 783cb1eb01b09a29d622d2981614dc0c36e21e2e
Author: Oscar Farga <os...@netcentric.biz>
AuthorDate: Mon Jan 14 23:08:21 2019 +0100
[MCOMPILER 366] - Warning about automodules should provide the list of offending libraries
- Collected filename based automodules detected and added to the log message.
- Updated unit tests accordingly.
- Added new integration test with 2 modules.
- 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/verify.groovy | 25 -----------
.../invoker.properties | 0
.../pom.xml | 44 +++++++++---------
.../src/main/java/module-info.java} | 9 ++--
.../src/main/java/org/maven/test/Main.java} | 18 +++++---
.../verify.groovy | 44 +++++++++---------
src/it/automodules-application/verify.groovy | 2 +-
src/it/automodules-library/verify.groovy | 2 +-
src/it/automodules-transitive-module/verify.groovy | 2 +-
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 +-
.../apache/maven/plugin/compiler/CompilerMojo.java | 52 +++++++++++++---------
.../plugin/compiler/CompilerMojoTestCase.java | 14 +++---
34 files changed, 121 insertions(+), 210 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/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/MCOMPILER-275_separate-moduleinfo/invoker.properties b/src/it/MCOMPILER-366/invoker.properties
similarity index 100%
copy from src/it/MCOMPILER-275_separate-moduleinfo/invoker.properties
copy to src/it/MCOMPILER-366/invoker.properties
diff --git a/src/it/MCOMPILER-332_release10/pom.xml b/src/it/MCOMPILER-366/pom.xml
similarity index 67%
rename from src/it/MCOMPILER-332_release10/pom.xml
rename to src/it/MCOMPILER-366/pom.xml
index e520e08..35444fc 100644
--- a/src/it/MCOMPILER-332_release10/pom.xml
+++ b/src/it/MCOMPILER-366/pom.xml
@@ -24,34 +24,38 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.plugins.compiler.it</groupId>
- <artifactId>mcompiler332</artifactId>
+ <artifactId>mcompiler-366</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>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <release>9</release>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.2</version>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-resources</artifactId>
+ <version>1.1.0</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-366/src/main/java/module-info.java
similarity index 89%
rename from src/it/MCOMPILER-332_release10/src/main/java/MyClass.java
rename to src/it/MCOMPILER-366/src/main/java/module-info.java
index 4945381..95e7266 100644
--- a/src/it/MCOMPILER-332_release10/src/main/java/MyClass.java
+++ b/src/it/MCOMPILER-366/src/main/java/module-info.java
@@ -16,8 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-public class MyClass
+module lib
{
-
-}
+ requires plexus.utils;
+ requires plexus.resources;
+ exports org.maven.test;
+}
\ No newline at end of file
diff --git a/src/it/MCOMPILER-332_release10/src/test/java/MyTest.java b/src/it/MCOMPILER-366/src/main/java/org/maven/test/Main.java
similarity index 70%
rename from src/it/MCOMPILER-332_release10/src/test/java/MyTest.java
rename to src/it/MCOMPILER-366/src/main/java/org/maven/test/Main.java
index 46ba41d..f2c4a2f 100644
--- a/src/it/MCOMPILER-332_release10/src/test/java/MyTest.java
+++ b/src/it/MCOMPILER-366/src/main/java/org/maven/test/Main.java
@@ -1,3 +1,5 @@
+package org.maven.test;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -17,10 +19,16 @@
* under the License.
*/
-import junit.framework.TestCase;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.resource.ResourceManager;
-public class MyTest
- extends TestCase
-{
+public class Main {
-}
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ System.out.println( StringUtils.concatenate( args ) );
+ ResourceManager manager = null;
+ }
+}
\ No newline at end of file
diff --git a/src/it/automodules-transitive-module/verify.groovy b/src/it/MCOMPILER-366/verify.groovy
similarity index 86%
copy from src/it/automodules-transitive-module/verify.groovy
copy to src/it/MCOMPILER-366/verify.groovy
index fb2d1d1..c5a90ad 100644
--- a/src/it/automodules-transitive-module/verify.groovy
+++ b/src/it/MCOMPILER-366/verify.groovy
@@ -1,22 +1,22 @@
-/*
- * 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.
- */
-
-buildLog = new File( basedir, 'build.log' ).text;
-
-assert buildLog.contains("[WARNING] * Required filename-based automodules detected. Please don't publish this project to a public artifact repository! *");
+/*
+ * 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.
+ */
+
+buildLog = new File( basedir, 'build.log' ).text;
+
+assert buildLog.contains("[WARNING] * Required filename-based automodules detected: [plexus-utils-2.0.4.jar, plexus-resources-1.1.0.jar]. Please don't publish this project to a public artifact repository! *");
diff --git a/src/it/automodules-application/verify.groovy b/src/it/automodules-application/verify.groovy
index 4ce088d..7f2654b 100644
--- a/src/it/automodules-application/verify.groovy
+++ b/src/it/automodules-application/verify.groovy
@@ -19,4 +19,4 @@
buildLog = new File( basedir, 'build.log' ).text;
-assert buildLog.contains("[INFO] Required filename-based automodules detected. Please don't publish this project to a public artifact repository!");
+assert buildLog.contains("[INFO] Required filename-based automodules detected: [plexus-utils-2.0.4.jar]. Please don't publish this project to a public artifact repository!");
diff --git a/src/it/automodules-library/verify.groovy b/src/it/automodules-library/verify.groovy
index fb2d1d1..6a014a5 100644
--- a/src/it/automodules-library/verify.groovy
+++ b/src/it/automodules-library/verify.groovy
@@ -19,4 +19,4 @@
buildLog = new File( basedir, 'build.log' ).text;
-assert buildLog.contains("[WARNING] * Required filename-based automodules detected. Please don't publish this project to a public artifact repository! *");
+assert buildLog.contains("[WARNING] * Required filename-based automodules detected: [plexus-utils-2.0.4.jar]. Please don't publish this project to a public artifact repository! *");
diff --git a/src/it/automodules-transitive-module/verify.groovy b/src/it/automodules-transitive-module/verify.groovy
index fb2d1d1..6a014a5 100644
--- a/src/it/automodules-transitive-module/verify.groovy
+++ b/src/it/automodules-transitive-module/verify.groovy
@@ -19,4 +19,4 @@
buildLog = new File( basedir, 'build.log' ).text;
-assert buildLog.contains("[WARNING] * Required filename-based automodules detected. Please don't publish this project to a public artifact repository! *");
+assert buildLog.contains("[WARNING] * Required filename-based automodules detected: [plexus-utils-2.0.4.jar]. Please don't publish this project to a public artifact repository! *");
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/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
index 568b063..8bc437b 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
@@ -250,26 +250,7 @@ public class CompilerMojo
JavaModuleDescriptor moduleDescriptor = resolvePathsResult.getMainModuleDescriptor();
- for ( Map.Entry<File, ModuleNameSource> entry : resolvePathsResult.getModulepathElements().entrySet() )
- {
- if ( ModuleNameSource.FILENAME.equals( entry.getValue() ) )
- {
- final String message = "Required filename-based automodules detected. "
- + "Please don't publish this project to a public artifact repository!";
-
- if ( moduleDescriptor.exports().isEmpty() )
- {
- // application
- getLog().info( message );
- }
- else
- {
- // library
- writeBoxedWarning( message );
- }
- break;
- }
- }
+ detectFilenameBasedAutomodules( resolvePathsResult, moduleDescriptor );
for ( Map.Entry<File, JavaModuleDescriptor> entry : resolvePathsResult.getPathElements().entrySet() )
{
@@ -324,6 +305,37 @@ public class CompilerMojo
modulepathElements = Collections.emptyList();
}
}
+
+ private void detectFilenameBasedAutomodules( final ResolvePathsResult<File> resolvePathsResult,
+ final JavaModuleDescriptor moduleDescriptor )
+ {
+ List<String> automodulesDetected = new ArrayList<>();
+ for ( Entry<File, ModuleNameSource> entry : resolvePathsResult.getModulepathElements().entrySet() )
+ {
+ if ( ModuleNameSource.FILENAME.equals( entry.getValue() ) )
+ {
+ automodulesDetected.add( entry.getKey().getName() );
+ }
+ }
+
+ if ( !automodulesDetected.isEmpty() )
+ {
+ final String message = "Required filename-based automodules detected: "
+ + automodulesDetected + ". "
+ + "Please don't publish this project to a public artifact repository!";
+
+ if ( moduleDescriptor.exports().isEmpty() )
+ {
+ // application
+ getLog().info( message );
+ }
+ else
+ {
+ // library
+ writeBoxedWarning( message );
+ }
+ }
+ }
private List<File> getCompileClasspathElements( MavenProject project )
{
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";
}
}