cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject [cxf-xjc-utils] branch master updated: [CXF-7683]Codegen fails when using JDK10 with maven and cxf-plugin
Date Wed, 28 Mar 2018 06:38:47 GMT
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-xjc-utils.git


The following commit(s) were added to refs/heads/master by this push:
     new b3b9407  [CXF-7683]Codegen fails when using JDK10 with maven and cxf-plugin
b3b9407 is described below

commit b3b940793c20540b0f63214c7580ff04b545ebf2
Author: Freeman Fang <freeman.fang@gmail.com>
AuthorDate: Wed Mar 28 14:38:34 2018 +0800

    [CXF-7683]Codegen fails when using JDK10 with maven and cxf-plugin
---
 .../org/apache/cxf/maven_plugin/AbstractXSDToJavaMojo.java    | 11 ++++++++++-
 pom.xml                                                       |  4 ++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractXSDToJavaMojo.java
b/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractXSDToJavaMojo.java
index 4b1232d..56fb83f 100644
--- a/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractXSDToJavaMojo.java
+++ b/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractXSDToJavaMojo.java
@@ -153,7 +153,7 @@ public abstract class AbstractXSDToJavaMojo extends AbstractMojo {
         }
     }
     public void execute() throws MojoExecutionException {
-        if (System.getProperty("java.version").startsWith("9")) {
+        if (isJava9Compatible()) {
             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
"
@@ -341,6 +341,15 @@ public abstract class AbstractXSDToJavaMojo extends AbstractMojo {
     protected List<String> getClasspathElements() throws DependencyResolutionRequiredException
{
         return project.getCompileClasspathElements();
     }
+
+    protected boolean isJava9Compatible() {
+        String version = System.getProperty("java.version");
+        if (version.indexOf(".") > 0) {
+            version = version.substring(0, version.indexOf("."));
+        }
+        
+        return Integer.valueOf(version) >= 9;
+    }
     
     private int run(XsdOption option, String xsdFile, String outputDir) throws Exception
{
         if (!fork) {
diff --git a/pom.xml b/pom.xml
index d950cbe..d2de361 100644
--- a/pom.xml
+++ b/pom.xml
@@ -585,9 +585,9 @@
              </build>
         </profile>
         <profile>
-            <id>java9</id>
+            <id>java9-plus</id>
             <activation>
-                <jdk>9</jdk>
+                <jdk>[9,)</jdk>
             </activation>
             <dependencies>
                 <dependency>

-- 
To stop receiving notification emails like this one, please contact
ffang@apache.org.

Mime
View raw message