You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2017/10/24 09:10:34 UTC

[cxf] branch master updated: [CXF-7517]detect jvm version and specify necessary jvm args for java9 so that users needn't specify it in plugin configuration

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

ffang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new d529ecd  [CXF-7517]detect jvm version and specify necessary jvm args for java9 so that users needn't specify it in plugin configuration
d529ecd is described below

commit d529ecd2252046c0e55fbe7b5e6a24c7b0d07301
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Tue Oct 24 17:10:22 2017 +0800

    [CXF-7517]detect jvm version and specify necessary jvm args for java9 so that users needn't specify it in plugin configuration
---
 .../org/apache/cxf/maven_plugin/AbstractCodegenMoho.java  | 15 +++++++++++++++
 .../java/org/apache/cxf/maven_plugin/Java2WSMojo.java     | 15 +++++++++++++++
 .../maven_plugin/wadlto/AbstractCodeGeneratorMojo.java    | 13 +++++++------
 .../org/apache/cxf/maven_plugin/wadlto/WADL2JavaMojo.java | 15 +++++++++++++++
 parent/pom.xml                                            |  4 ----
 5 files changed, 52 insertions(+), 10 deletions(-)

diff --git a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
index 4dd2516..a19e4eb 100644
--- a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
+++ b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
@@ -203,6 +203,21 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
     }
 
     public void execute() throws MojoExecutionException {
+        if (System.getProperty("java.version").startsWith("9")) {
+            fork = "true";
+            additionalJvmArgs = "--add-modules java.activation,java.xml.bind,java.xml.ws " 
+                    + "--add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime=ALL-UNNAMED "
+                    + "--add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED "
+                    + "--add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED "
+                    + "--add-exports=java.xml.bind/com.sun.xml.internal.bind.marshaller=ALL-UNNAMED "
+                    + "--add-opens java.xml.ws/javax.xml.ws.wsaddressing=ALL-UNNAMED "
+                    + "--add-opens java.base/java.security=ALL-UNNAMED "
+                    + "--add-opens java.base/java.net=ALL-UNNAMED "
+                    + "--add-opens java.base/java.lang=ALL-UNNAMED "
+                    + "--add-opens java.base/java.util=ALL-UNNAMED "
+                    + "--add-opens java.base/java.util.concurrent=ALL-UNNAMED " 
+                    + (additionalJvmArgs == null ? "" : additionalJvmArgs); 
+        }
         System.setProperty("org.apache.cxf.JDKBugHacks.defaultUsesCaches", "true");
 
         // add the generated source into compile source
diff --git a/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java b/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java
index 5b2576f..fc996a6 100644
--- a/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java
+++ b/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java
@@ -209,6 +209,21 @@ public class Java2WSMojo extends AbstractMojo {
     private String additionalJvmArgs;
 
     public void execute() throws MojoExecutionException {
+        if (System.getProperty("java.version").startsWith("9")) {
+            fork = true;
+            additionalJvmArgs = "--add-modules java.activation,java.xml.bind,java.xml.ws " 
+                    + "--add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime=ALL-UNNAMED "
+                    + "--add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED "
+                    + "--add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED "
+                    + "--add-exports=java.xml.bind/com.sun.xml.internal.bind.marshaller=ALL-UNNAMED "
+                    + "--add-opens java.xml.ws/javax.xml.ws.wsaddressing=ALL-UNNAMED "
+                    + "--add-opens java.base/java.security=ALL-UNNAMED "
+                    + "--add-opens java.base/java.net=ALL-UNNAMED "
+                    + "--add-opens java.base/java.lang=ALL-UNNAMED "
+                    + "--add-opens java.base/java.util=ALL-UNNAMED "
+                    + "--add-opens java.base/java.util.concurrent=ALL-UNNAMED " 
+                    + (additionalJvmArgs == null ? "" : additionalJvmArgs); 
+        }
         System.setProperty("org.apache.cxf.JDKBugHacks.defaultUsesCaches", "true");
         if (skip) {
             getLog().info("Skipping Java2WS execution");
diff --git a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java
index 9625f8d..f114ba5 100644
--- a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java
+++ b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java
@@ -138,6 +138,12 @@ public abstract class AbstractCodeGeneratorMojo extends AbstractMojo {
      */
     @Parameter(defaultValue = "false")
     String fork;
+    
+    /**
+     * Sets the JVM arguments (i.e. <code>-Xms128m -Xmx128m</code>) if fork is set to <code>true</code>.
+     */
+    @Parameter
+    String additionalJvmArgs;
 
     /**
      * The Maven session.
@@ -158,12 +164,7 @@ public abstract class AbstractCodeGeneratorMojo extends AbstractMojo {
     @Parameter(defaultValue = "${java.home}/bin/java")
     private String javaExecutable;
 
-    /**
-     * Sets the JVM arguments (i.e. <code>-Xms128m -Xmx128m</code>) if fork is set to <code>true</code>.
-     */
-    @Parameter
-    private String additionalJvmArgs;
-
+    
     @Component
     private RepositorySystem repositorySystem;
 
diff --git a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/WADL2JavaMojo.java b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/WADL2JavaMojo.java
index c572d3e..cf4a806 100644
--- a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/WADL2JavaMojo.java
+++ b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/WADL2JavaMojo.java
@@ -73,6 +73,21 @@ public class WADL2JavaMojo extends AbstractCodeGeneratorMojo {
     }
 
     public void execute() throws MojoExecutionException {
+        if (System.getProperty("java.version").startsWith("9")) {
+            fork = "true";
+            additionalJvmArgs = "--add-modules java.activation,java.xml.bind,java.xml.ws " 
+                    + "--add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime=ALL-UNNAMED "
+                    + "--add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED "
+                    + "--add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED "
+                    + "--add-exports=java.xml.bind/com.sun.xml.internal.bind.marshaller=ALL-UNNAMED "
+                    + "--add-opens java.xml.ws/javax.xml.ws.wsaddressing=ALL-UNNAMED "
+                    + "--add-opens java.base/java.security=ALL-UNNAMED "
+                    + "--add-opens java.base/java.net=ALL-UNNAMED "
+                    + "--add-opens java.base/java.lang=ALL-UNNAMED "
+                    + "--add-opens java.base/java.util=ALL-UNNAMED "
+                    + "--add-opens java.base/java.util.concurrent=ALL-UNNAMED " 
+                    + (additionalJvmArgs == null ? "" : additionalJvmArgs); 
+        }
         System.setProperty("org.apache.cxf.JDKBugHacks.defaultUsesCaches", "true");
 
         File classesDir = new File(classesDirectory);
diff --git a/parent/pom.xml b/parent/pom.xml
index 86e28d3..5d865d2 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -2324,10 +2324,6 @@
                 <cxf.pax.exam.version>4.11.0</cxf.pax.exam.version>
                 <cxf.server.launcher.vmargs>-ea --patch-module java.xml.ws.annotation=${project.basedir}/target/java9/javax.annotation-api-${cxf.javax.annotation-api.version}.jar --patch-module java.transaction=${project.basedir}/target/java9 --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime.reflect=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.in [...]
                 <cxf.surefire.fork.vmargs>-ea --patch-module java.xml.ws.annotation=${project.basedir}/target/java9/javax.annotation-api-${cxf.javax.annotation-api.version}.jar --patch-module java.transaction=${project.basedir}/target/java9 --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.run [...]
-                <cxf.xjc.jvmArgs>--add-modules java.activation,java.xml.bind,java.xml.ws --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind.marshaller=ALL-UNNAMED --add-opens java.xml.ws/javax.xml.ws.wsaddressing=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add- [...]
-                <cxf.codegen.jvmArgs>--add-modules java.activation,java.xml.bind,java.xml.ws --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind.marshaller=ALL-UNNAMED --add-opens java.xml.ws/javax.xml.ws.wsaddressing=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED -- [...]
-                <cxf.codegenplugin.forkmode>true</cxf.codegenplugin.forkmode>
-                <cxf.xjcplugin.forkmode>true</cxf.xjcplugin.forkmode>
 	    </properties>
 	    <activation>
         	<jdk>9</jdk>

-- 
To stop receiving notification emails like this one, please contact
['"commits@cxf.apache.org" <co...@cxf.apache.org>'].