Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8187

Codegen-Plugin failed when maven is executed on jdk9+ with Toolchains specifying jdk 8

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.4
    • Fix Version/s: 3.3.5
    • Component/s: Tooling
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      Codegen-Plugin failed when :

      1. maven is executed on jdk9+ (ex : JAVA_HOME on a JDK 11)
      2. JDK 8 is asked through toolchain plugin

      Sample of execution result :

      [INFO] --- cxf-codegen-plugin:3.3.4:wsdl2java (xxxxx) @ xxxxx ---
      [INFO] Running code generation in fork mode...
      [INFO] Using toolchain JDK[c:/jdk1.8] to find the java executable
      [INFO] The java executable is c:\jdk1.8\bin\java.exe
      [INFO] Building jar: C:\tmp\cxf-tmp-13126677158727590310\cxf-codegen13282347933764786924.jar
      [WARNING] Error: Could not create the Java Virtual Machine.
      [WARNING] Error: A fatal exception has occurred. Program will exit.
      [WARNING] Unrecognized option: --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED
      [....]
      [ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:3.3.4:wsdl2java (xxxxx) on project xxxxx:
      [ERROR] Exit code: 1
      [ERROR] Command line was: cmd.exe /X /C "c:\jdk1.8\bin\java.exe --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-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 -jar C:\tmp\cxf-tmp-13126677158727590310\cxf-codegen13282347933764786924.jar C:\tmp\cxf-tmp-13126677158727590310\cxf-w2j10127470885320069515args"
      

      The error seems to come from the additionalJvmArgs for java 9 (--add-exports=..., --add-opens=...) : the command line manually executed failled with these args but succeed whithout). It seems that AbstractCodegenMojo#execute() doesn't test the right JDK to detect if the java 9 additionalJvmArgs should be add : the test is currently on the JDK used by maven instead of the one that will be run by Codegen-Plugin.

      Regards

        Attachments

          Activity

            People

            • Assignee:
              coheigea Colm O hEigeartaigh
              Reporter:
              cjanton JANTON
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: