JANTON created CXF-8187:
---------------------------
Summary: Codegen-Plugin failed when maven is executed on jdk9+
with Toolchains specifying jdk 8
Key: CXF-8187
URL: https://issues.apache.org/jira/browse/CXF-8187
Project: CXF
Issue Type: Bug
Components: Tooling
Affects Versions: 3.3.4
Reporter: JANTON
Codegen-Plugin failed when :
# maven is executed on jdk9+ (ex : JAVA_HOME on a JDK 11)
# JDK 8 is asked through toolchain plugin
Sample of execution result :
{code}
[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"
{code}
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()|https://github.com/apache/cxf/blob/cxf-3.3.4/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java]
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
--
This message was sent by Atlassian Jira
(v8.3.4#803005)