You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2017/08/22 20:45:52 UTC

svn commit: r1805828 - in /maven/plugins/trunk/maven-compiler-plugin: ./ src/it/jpms_add-exports/ src/it/jpms_add-exports/src/ src/it/jpms_add-exports/src/main/ src/it/jpms_add-exports/src/main/java/ src/it/jpms_add-exports/src/main/java/org/ src/it/jp...

Author: rfscholte
Date: Tue Aug 22 20:45:52 2017
New Revision: 1805828

URL: http://svn.apache.org/viewvc?rev=1805828&view=rev
Log:
[MCOMPILER-296] Add jpms.args to the META-INF folder

Added:
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/invoker.properties
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/pom.xml
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/module-info.java
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/org/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/org/maven/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/org/maven/test/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/org/maven/test/Main.java
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/verify.groovy
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/invoker.properties
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/pom.xml
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/module-info.java
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/org/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/org/maven/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/org/maven/test/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/org/maven/test/Main.java
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/test/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/test/java/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/test/java/org/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/test/java/org/maven/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/test/java/org/maven/test/
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/test/java/org/maven/test/MainTest.java
    maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/verify.groovy
    maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/jpms_args.apt.vm
Modified:
    maven/plugins/trunk/maven-compiler-plugin/pom.xml
    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
    maven/plugins/trunk/maven-compiler-plugin/src/site/fml/faq.fml

Modified: maven/plugins/trunk/maven-compiler-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/pom.xml?rev=1805828&r1=1805827&r2=1805828&view=diff
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-compiler-plugin/pom.xml Tue Aug 22 20:45:52 2017
@@ -113,7 +113,7 @@ under the License.
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-java</artifactId>
-      <version>0.9.1</version>
+      <version>0.9.2</version>
     </dependency>
 
     <dependency>
@@ -221,7 +221,7 @@ under the License.
       <plugin>
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-component-metadata</artifactId>
-        <version>1.7</version>
+        <version>1.7.1</version>
         <executions>
           <execution>
             <id>descriptors</id>

Added: maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/invoker.properties?rev=1805828&view=auto
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/invoker.properties (added)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/invoker.properties Tue Aug 22 20:45:52 2017
@@ -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 = 9+

Added: maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/pom.xml?rev=1805828&view=auto
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/pom.xml (added)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/pom.xml Tue Aug 22 20:45:52 2017
@@ -0,0 +1,52 @@
+<?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>illegal-access</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <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>
+            <compilerArgs>
+              <arg>--add-exports</arg>
+              <arg>app/org.maven.test=ALL_UNNAMED</arg>
+            </compilerArgs>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>

Added: maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/module-info.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/module-info.java?rev=1805828&view=auto
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/module-info.java (added)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/module-info.java Tue Aug 22 20:45:52 2017
@@ -0,0 +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.
+ */
+module app 
+{
+        
+}
\ No newline at end of file

Added: maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/org/maven/test/Main.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/org/maven/test/Main.java?rev=1805828&view=auto
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/org/maven/test/Main.java (added)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/src/main/java/org/maven/test/Main.java Tue Aug 22 20:45:52 2017
@@ -0,0 +1,36 @@
+package org.maven.test;
+
+/*
+ * 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 Main {
+    
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        try {
+            Class.forName( "jdk.internal.util.Preconditions" ).newInstance();    
+        }
+        catch ( Exception e  )
+        {
+            // noop
+        }
+    }
+}

Added: maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/verify.groovy?rev=1805828&view=auto
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/verify.groovy (added)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_add-exports/verify.groovy Tue Aug 22 20:45:52 2017
@@ -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.
+ */
+
+def jpmsArgs = new File( basedir, 'target/classes/META-INF/jpms.args' );
+def lines = jpmsArgs.readLines();
+assert lines[0] == "--add-exports"
+assert lines[1] == "app/org.maven.test=ALL_UNNAMED"

Added: maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/invoker.properties?rev=1805828&view=auto
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/invoker.properties (added)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/invoker.properties Tue Aug 22 20:45:52 2017
@@ -0,0 +1,19 @@
+# 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 = 9+
+invoker.goals = test-compile

Added: maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/pom.xml?rev=1805828&view=auto
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/pom.xml (added)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/pom.xml Tue Aug 22 20:45:52 2017
@@ -0,0 +1,48 @@
+<?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>patch-module</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <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>
+</project>

Added: maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/module-info.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/module-info.java?rev=1805828&view=auto
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/module-info.java (added)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/module-info.java Tue Aug 22 20:45:52 2017
@@ -0,0 +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.
+ */
+module app 
+{
+        
+}
\ No newline at end of file

Added: maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/org/maven/test/Main.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/org/maven/test/Main.java?rev=1805828&view=auto
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/org/maven/test/Main.java (added)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/main/java/org/maven/test/Main.java Tue Aug 22 20:45:52 2017
@@ -0,0 +1,36 @@
+package org.maven.test;
+
+/*
+ * 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 Main {
+    
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        try {
+            Class.forName( "jdk.internal.util.Preconditions" ).newInstance();    
+        }
+        catch ( Exception e  )
+        {
+            // noop
+        }
+    }
+}

Added: maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/test/java/org/maven/test/MainTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/test/java/org/maven/test/MainTest.java?rev=1805828&view=auto
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/test/java/org/maven/test/MainTest.java (added)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/src/test/java/org/maven/test/MainTest.java Tue Aug 22 20:45:52 2017
@@ -0,0 +1,30 @@
+package org.maven.test;
+
+/*
+ * 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 MainTest {
+    
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        Main.main( args );
+    }
+}

Added: maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/verify.groovy?rev=1805828&view=auto
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/verify.groovy (added)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/jpms_patch-module/verify.groovy Tue Aug 22 20:45:52 2017
@@ -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 jpmsArgs = new File( basedir, 'target/test-classes/META-INF/jpms.args' );
+def lines = jpmsArgs.readLines();
+assert lines[0] == "--patch-module"
+assert lines[1] == "app=_"
+assert lines[2] == "--add-reads"
+assert lines[3] == "app=ALL-UNNAMED"

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=1805828&r1=1805827&r2=1805828&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 Tue Aug 22 20:45:52 2017
@@ -20,11 +20,18 @@ package org.apache.maven.plugin.compiler
  */
 
 import java.io.File;
+import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
@@ -68,6 +75,7 @@ import org.codehaus.plexus.compiler.util
 import org.codehaus.plexus.compiler.util.scan.mapping.SingleTargetSourceMapping;
 import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
 import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
+import org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor;
 
 /**
  * TODO: At least one step could be optimized, currently the plugin will do two
@@ -83,6 +91,7 @@ import org.codehaus.plexus.compiler.util
 public abstract class AbstractCompilerMojo
     extends AbstractMojo
 {
+    protected static final String PS = System.getProperty( "path.separator" );
 
     static final String DEFAULT_SOURCE = "1.5";
     
@@ -492,6 +501,8 @@ public abstract class AbstractCompilerMo
 
     protected abstract List<String> getModulepathElements();
 
+    protected abstract Map<String, JavaModuleDescriptor> getPathElements();
+
     protected abstract List<String> getCompileSourceRoots();
     
     protected abstract void preparePaths( Set<File> sourceFiles );
@@ -863,7 +874,7 @@ public abstract class AbstractCompilerMo
                 }
             }
         }
-
+        
         // ----------------------------------------------------------------------
         // Dump configuration
         // ----------------------------------------------------------------------
@@ -922,6 +933,118 @@ public abstract class AbstractCompilerMo
                 getLog().debug( ce );
             }
         }
+        
+
+        List<String> jpmsLines = new ArrayList<String>();
+        
+        // See http://openjdk.java.net/jeps/261
+        final List<String> runtimeArgs = Arrays.asList( "--upgrade-module-path", 
+                                                  "--add-exports",
+                                                  "--add-reads", 
+                                                  "--add-modules", 
+                                                  "--limit-modules" );
+        
+        // Custom arguments are all added as keys to an ordered Map
+        Iterator<Map.Entry<String, String>> entryIter =
+            compilerConfiguration.getCustomCompilerArgumentsEntries().iterator();
+        while ( entryIter.hasNext() )
+        {
+            Map.Entry<String, String> entry = entryIter.next();
+            
+            if ( runtimeArgs.contains( entry.getKey() ) )
+            {
+                jpmsLines.add( entry.getKey() );
+                
+                String value = entry.getValue();
+                if ( value == null )
+                {
+                    entry = entryIter.next();
+                    value = entry.getKey();
+                }
+                jpmsLines.add( value );
+            }
+            else if ( "--patch-module".equals( entry.getKey() ) )
+            {
+                jpmsLines.add( "--patch-module" );
+                
+                String value = entry.getValue();
+                if ( value == null )
+                {
+                    entry = entryIter.next();
+                    value = entry.getKey();
+                }
+                
+                String[] values = value.split( "=" );
+
+                StringBuilder patchModule = new StringBuilder( values[0] );
+                patchModule.append( '=' );
+
+                Set<String> patchModules = new LinkedHashSet<>();
+                Set<Path> sourceRoots = new HashSet<>( getCompileSourceRoots().size() );
+                for ( String sourceRoot : getCompileSourceRoots() )
+                {
+                    sourceRoots.add( Paths.get( sourceRoot ) );
+                }
+
+                String[] files = values[1].split( PS );
+
+                for ( String file : files )
+                {
+                    Path filePath = Paths.get( file );
+                    if ( getOutputDirectory().toPath().equals( filePath ) )
+                    {
+                        patchModules.add( "_" ); // this jar
+                    }
+                    else if ( sourceRoots.contains( filePath ) )
+                    {
+                        patchModules.add( "_" ); // this jar
+                    }
+                    else
+                    {
+                        JavaModuleDescriptor descriptor = getPathElements().get( file );
+                        
+                        if ( descriptor == null )
+                        {
+                            getLog().warn( "Can't locate " + file );
+                        }
+                        else if ( !values[0].equals( descriptor.name() ) )
+                        {
+                            patchModules.add( descriptor.name() );
+                        }
+                    }
+                }
+
+                StringBuilder sb = new StringBuilder();
+                
+                for ( String mod : patchModules )
+                {
+                    if ( sb.length() > 0 )
+                    {
+                        sb.append( ", " );
+                    }
+                    // use 'invalid' separator to ensure values are transformed
+                    sb.append( mod );
+                }
+
+                jpmsLines.add( patchModule + sb.toString() );
+            }
+        }
+        
+        if ( !jpmsLines.isEmpty() ) 
+        {
+            Path jpmsArgs = Paths.get( getOutputDirectory().getAbsolutePath(), "META-INF/jpms.args" );
+            try
+            {
+                Files.createDirectories( jpmsArgs.getParent() );
+                
+                Files.write( jpmsArgs, jpmsLines, Charset.defaultCharset() );
+            }
+            catch ( IOException e )
+            {
+                getLog().warn( e.getMessage() );
+            }
+        }
+
 
         // ----------------------------------------------------------------------
         // Compile!

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=1805828&r1=1805827&r2=1805828&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 Tue Aug 22 20:45:52 2017
@@ -25,12 +25,14 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
@@ -45,7 +47,6 @@ import org.codehaus.plexus.compiler.util
 import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
 import org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor;
 import org.codehaus.plexus.languages.java.jpms.LocationManager;
-import org.codehaus.plexus.languages.java.jpms.QDoxModuleInfoParser;
 import org.codehaus.plexus.languages.java.jpms.ResolvePathsRequest;
 import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult;
 import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult.ModuleNameSource;
@@ -117,19 +118,21 @@ public class CompilerMojo
     @Parameter
     private boolean allowPartialRequirements;
 
-    private QDoxModuleInfoParser moduleInfoParser = new QDoxModuleInfoParser();
-
-    private LocationManager locationManager = new LocationManager();
+    @Component
+    private LocationManager locationManager;
 
     private List<String> classpathElements;
 
     private List<String> modulepathElements;
+    
+    private Map<String, JavaModuleDescriptor> pathElements;
 
     protected List<String> getCompileSourceRoots()
     {
         return compileSourceRoots;
     }
 
+    @Override
     protected List<String> getClasspathElements()
     {
         return classpathElements;
@@ -141,6 +144,13 @@ public class CompilerMojo
         return modulepathElements;
     }
 
+    @Override
+    protected Map<String, JavaModuleDescriptor> getPathElements()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
     protected File getOutputDirectory()
     {
         return outputDirectory;
@@ -168,21 +178,14 @@ public class CompilerMojo
     {
         assert compilePath != null;
 
-        JavaModuleDescriptor moduleDescriptor = null;
+        File moduleDescriptorPath = null;
 
         boolean hasModuleDescriptor = false;
         for ( File sourceFile : sourceFiles )
         {
             if ( "module-info.java".equals( sourceFile.getName() ) )
             {
-                try
-                {
-                    moduleDescriptor = moduleInfoParser.fromSourcePath( sourceFile.getParentFile().toPath() );
-                }
-                catch ( IOException e )
-                {
-                    getLog().warn( "Failed to parse module-info.java: " + e.getMessage() );
-                }
+                moduleDescriptorPath = sourceFile;
                 hasModuleDescriptor = true;
                 break;
             }
@@ -196,14 +199,16 @@ public class CompilerMojo
 
             modulepathElements = new ArrayList<String>( compilePath.size() );
             classpathElements = new ArrayList<String>( compilePath.size() );
+            pathElements = new LinkedHashMap<String, JavaModuleDescriptor>( compilePath.size() );
 
-            ResolvePathsResult<File> analyzerResult;
+            ResolvePathsResult<File> resolvePathsResult;
             try
             {
                 Collection<File> dependencyArtifacts = getCompileClasspathElements( getProject() );
                 
                 ResolvePathsRequest<File> request =
-                    ResolvePathsRequest.withFiles( dependencyArtifacts ).setMainModuleDescriptor( moduleDescriptor );
+                    ResolvePathsRequest.withFiles( dependencyArtifacts )
+                                       .setMainModuleDescriptor( moduleDescriptorPath );
                 
                 Toolchain toolchain = getToolchain();
                 if ( toolchain != null && toolchain instanceof DefaultJavaToolChain )
@@ -211,9 +216,11 @@ public class CompilerMojo
                     request.setJdkHome( new File( ( (DefaultJavaToolChain) toolchain ).getJavaHome() ) );
                 }
 
-                analyzerResult = locationManager.resolvePaths( request );
+                resolvePathsResult = locationManager.resolvePaths( request );
+                
+                JavaModuleDescriptor moduleDescriptor = resolvePathsResult.getMainModuleDescriptor();
 
-                for ( Map.Entry<File, ModuleNameSource> entry : analyzerResult.getModulepathElements().entrySet() )
+                for ( Map.Entry<File, ModuleNameSource> entry : resolvePathsResult.getModulepathElements().entrySet() )
                 {
                     if ( ModuleNameSource.FILENAME.equals( entry.getValue() ) )
                     {
@@ -234,12 +241,17 @@ public class CompilerMojo
                     }
                 }
                 
-                for ( File file : analyzerResult.getClasspathElements() )
+                for ( Map.Entry<File, JavaModuleDescriptor> entry : resolvePathsResult.getPathElements().entrySet() )
+                {
+                    pathElements.put( entry.getKey().getPath(), entry.getValue() );
+                }
+                
+                for ( File file : resolvePathsResult.getClasspathElements() )
                 {
                     classpathElements.add( file.getPath() );
                 }
                 
-                for ( File file : analyzerResult.getModulepathElements().keySet() )
+                for ( File file : resolvePathsResult.getModulepathElements().keySet() )
                 {
                     modulepathElements.add( file.getPath() );
                 }

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=1805828&r1=1805827&r2=1805828&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 Tue Aug 22 20:45:52 2017
@@ -25,6 +25,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -39,7 +40,6 @@ import org.apache.maven.toolchain.java.D
 import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
 import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
 import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
-import org.codehaus.plexus.languages.java.jpms.AsmModuleInfoParser;
 import org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor;
 import org.codehaus.plexus.languages.java.jpms.LocationManager;
 import org.codehaus.plexus.languages.java.jpms.ResolvePathsRequest;
@@ -57,8 +57,6 @@ import org.codehaus.plexus.languages.jav
 public class TestCompilerMojo
     extends AbstractCompilerMojo
 {
-    protected static final String PS = System.getProperty( "path.separator" );
-    
     /**
      * Set this to 'true' to bypass compilation of test sources.
      * Its use is NOT RECOMMENDED, but quite convenient on occasion.
@@ -159,10 +157,10 @@ public class TestCompilerMojo
     @Parameter( defaultValue = "${project.testClasspathElements}", readonly = true )
     private List<String> testPath;
 
-    private AsmModuleInfoParser asmModuleInfoParser = new AsmModuleInfoParser();
-    
     private LocationManager locationManager = new LocationManager();
 
+    private Map<String, JavaModuleDescriptor> pathElements;
+    
     private Collection<String> classpathElements;
 
     private Collection<String> modulepathElements;
@@ -183,6 +181,12 @@ public class TestCompilerMojo
         return compileSourceRoots;
     }
 
+    @Override
+    protected Map<String, JavaModuleDescriptor> getPathElements()
+    {
+        return pathElements;
+    }
+
     protected List<String> getClasspathElements()
     {
         return new ArrayList<>( classpathElements );
@@ -223,6 +227,7 @@ public class TestCompilerMojo
         {
             if ( Integer.valueOf( release ) < 9 )
             {
+                pathElements = Collections.emptyMap();
                 modulepathElements = Collections.emptyList();
                 classpathElements = testPath;
                 return;
@@ -230,6 +235,7 @@ public class TestCompilerMojo
         }
         else if ( Double.valueOf( getTarget() ) < Double.valueOf( MODULE_INFO_TARGET ) )
         {
+            pathElements = Collections.emptyMap();
             modulepathElements = Collections.emptyList();
             classpathElements = testPath;
             return;
@@ -258,20 +264,18 @@ public class TestCompilerMojo
         {
             if ( hasMainModuleDescriptor )
             {
-                JavaModuleDescriptor moduleDescriptor;
                 ResolvePathsResult<String> result;
                 
                 try
                 {
-                    moduleDescriptor = getModuleDescriptor( mainOutputDirectory );
-
                     ResolvePathsRequest<String> request =
-                        ResolvePathsRequest.withStrings( testPath ).setMainModuleDescriptor( moduleDescriptor );
+                        ResolvePathsRequest.withStrings( testPath )
+                                           .setMainModuleDescriptor( mainOutputDirectory.getAbsolutePath() );
                     
                     Toolchain toolchain = getToolchain();
                     if ( toolchain != null && toolchain instanceof DefaultJavaToolChain )
                     {
-                        request.setJdkHome( new File( ( (DefaultJavaToolChain) toolchain ).getJavaHome() ) );
+                        request.setJdkHome( ( (DefaultJavaToolChain) toolchain ).getJavaHome() );
                     }
                     
                     result = locationManager.resolvePaths( request );
@@ -281,6 +285,11 @@ public class TestCompilerMojo
                     throw new RuntimeException( e );
                 }
                 
+                JavaModuleDescriptor moduleDescriptor = result.getMainModuleDescriptor();
+                
+                pathElements = new LinkedHashMap<String, JavaModuleDescriptor>( result.getPathElements().size() );
+                pathElements.putAll( result.getPathElements() );
+                                
                 modulepathElements = result.getModulepathElements().keySet();
                 classpathElements = result.getClasspathElements();
                 
@@ -290,16 +299,16 @@ public class TestCompilerMojo
                 }
                 compilerArgs.add( "--patch-module" );
                 
-                StringBuilder addReadsValue = new StringBuilder( moduleDescriptor.name() )
+                StringBuilder patchModuleValue = new StringBuilder( moduleDescriptor.name() )
                                 .append( '=' )
                                 .append( mainOutputDirectory )
                                 .append( PS );
                 for ( String root : compileSourceRoots )
                 {
-                    addReadsValue.append( root ).append( PS );
+                    patchModuleValue.append( root ).append( PS );
                 }
                 
-                compilerArgs.add( addReadsValue.toString() );
+                compilerArgs.add( patchModuleValue.toString() );
                 
                 compilerArgs.add( "--add-reads" );
                 compilerArgs.add( moduleDescriptor.name() + "=ALL-UNNAMED" );
@@ -312,11 +321,6 @@ public class TestCompilerMojo
         }
     }
 
-    private JavaModuleDescriptor getModuleDescriptor( File mainOutputDirectory ) throws IOException
-    {
-        return asmModuleInfoParser.getModuleDescriptor( mainOutputDirectory.toPath() );
-    }
-
     protected SourceInclusionScanner getSourceInclusionScanner( int staleMillis )
     {
         SourceInclusionScanner scanner;

Added: maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/jpms_args.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/jpms_args.apt.vm?rev=1805828&view=auto
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/jpms_args.apt.vm (added)
+++ maven/plugins/trunk/maven-compiler-plugin/src/site/apt/examples/jpms_args.apt.vm Tue Aug 22 20:45:52 2017
@@ -0,0 +1,62 @@
+ ------
+ jpms.args
+ ------
+ Robert Scholte
+ ------
+ 2017-08-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.
+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+
+JPMS.ARGS
+
+  Java 9 comes with a new set of arguments related to the Java Platform Modular System. Besides the module path are
+  other new arguments which can change the behavior of the application. These can be used during both compile time
+  and runtime. This information is not stored in any class, but it can be interesting to know at runtime which extra
+  arguments were used at compile time.
+  
+  If any of these arguments is used, the <<<META-INF/jpms.args>>> is created.
+  Every argument gets its own line.
+  The following arguments will end up in this file:
+  
+  * <<<--upgrade-module-path>>>
+  
+  * <<<--add-exports>>>
+  
+  * <<<--add-reads>>>
+  
+  * <<<--add-modules>>>
+  
+  * <<<--limit-modules>>>
+  
+  * <<<--patch-module>>>
+  
+  []
+  
+  The <<<--patch-module>>> values are different compared to the original values passed to the compiler. Occording to
+  the specification it looks like <<<--patch-module \<module\>=\<file\>(\<pathsep\>\<file\>)\*>>>
+  However, files are system specific. For that reason the module names are used. If the jar itself contains the 
+  patchcode, then an <<<_>>> (underscore) is used. As separators a <<<, >>> (comma + space) is used.
+  
++---  
+  --patch-module
+  <module>=<module>(, <module>)*
++---  
\ No newline at end of file

Modified: maven/plugins/trunk/maven-compiler-plugin/src/site/fml/faq.fml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/site/fml/faq.fml?rev=1805828&r1=1805827&r2=1805828&view=diff
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/site/fml/faq.fml (original)
+++ maven/plugins/trunk/maven-compiler-plugin/src/site/fml/faq.fml Tue Aug 22 20:45:52 2017
@@ -39,5 +39,11 @@ under the License.
         </p>
       </answer>
     </faq>
+    <faq id="jpms.args">
+      <question>Why is there sometimes a <code>META-INF/jpms.args</code> created?</question>
+      <answer>
+        <p>Read <a href="examples/jpms_args.html">jpms.args</a> for all the details.</p>
+      </answer>
+    </faq>
   </part>
 </faqs>