CXF codegen maven 插件不工作 OpenJDK 11
CXF codegen maven plugin doesn't work OpenJDK 11
我一直在使用 JDK 9 和 10 以及 CXF codegen 插件 3.2.5 和 3.2.6,没有任何问题,但是今天我正尝试从 Oracle JDK 更新我的代码库10 到 OpenJDK 11 build 28,但我总是遇到同样的错误:
[INFO] Error occurred during initialization of boot layer
[INFO] java.lang.module.FindException: Module java.xml.ws not found
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.747 s
[INFO] Finished at: 2018-10-17T16:38:38+02:00
[INFO] Final Memory: 17M/60M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:3.2.6:wsdl2java (cerberus-wsdl) on project cerberus:
[ERROR] Exit code: 1
[ERROR] Command line was: /opt/prod_jdk/bin/java --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 -jar /tmp/cxf-tmp-2828938832312113909/cxf-codegen12095310072621993552.jar /tmp/cxf-tmp-2828938832312113909/cxf-w2j12256414556760820901args
这是我的 pom.xml 使用 CXF codegen 插件:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.2.6</version>
<configuration>
<fork>once</fork>
</configuration>
<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
<executions>...</executions>
<plugin>
我错过了什么吗?据我所知,这应该与 JDK 9 和 10 中的工作方式相同。有一个问题 https://issues.apache.org/jira/browse/CXF-7741 讨论 JDK 11 兼容性,但这同样适用于 CXF 框架,而不是对于插件(我认为)。
此问题将在 cxf 3.3.0 中得到解决 (https://issues.apache.org/jira/browse/CXF-7852)
目前,您可以运行 mvn install在https://github.com/apache/cxf的mvn-plugins目录下构建插件,并将pom中的版本设置为3.3.0-快照
编辑:
插件在 apache 快照存储库中,所以从那里获取它可能更好:
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Maven Plugin Snapshots</name>
<url>http://repository.apache.org/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.3.0-SNAPSHOT</version>
...
注意(2019-01-28):插件现在released,我们可以照常添加依赖:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.3.0</version>
<type>maven-plugin</type>
</dependency>
我也在努力让插件与 Java 11 一起工作。
尝试详细说明插件依赖关系以解决问题:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>3.2.3</version>
<dependencies>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<!-- Java Architecture for XML Binding (JAXB), Java 11+ support -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<!-- JavaBeans Activation Framework (JAF), Java 11+ support -->
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>${jaf-api.version}</version>
</dependency>
<!-- Java API for XML Web Services (JAX-WS), Java 11+ support -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>${jaxws-api.version}</version>
</dependency>
</dependencies>
</plugin>
.. 运气不好。
当我升级到插件的 3.2.3 版本时,问题就消失了
(在等待 3.3.0 时,如此处所述:https://issues.apache.org/jira/browse/CXF-7852)。
我一直在使用 JDK 9 和 10 以及 CXF codegen 插件 3.2.5 和 3.2.6,没有任何问题,但是今天我正尝试从 Oracle JDK 更新我的代码库10 到 OpenJDK 11 build 28,但我总是遇到同样的错误:
[INFO] Error occurred during initialization of boot layer
[INFO] java.lang.module.FindException: Module java.xml.ws not found
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.747 s
[INFO] Finished at: 2018-10-17T16:38:38+02:00
[INFO] Final Memory: 17M/60M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:3.2.6:wsdl2java (cerberus-wsdl) on project cerberus:
[ERROR] Exit code: 1
[ERROR] Command line was: /opt/prod_jdk/bin/java --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 -jar /tmp/cxf-tmp-2828938832312113909/cxf-codegen12095310072621993552.jar /tmp/cxf-tmp-2828938832312113909/cxf-w2j12256414556760820901args
这是我的 pom.xml 使用 CXF codegen 插件:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.2.6</version>
<configuration>
<fork>once</fork>
</configuration>
<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
<executions>...</executions>
<plugin>
我错过了什么吗?据我所知,这应该与 JDK 9 和 10 中的工作方式相同。有一个问题 https://issues.apache.org/jira/browse/CXF-7741 讨论 JDK 11 兼容性,但这同样适用于 CXF 框架,而不是对于插件(我认为)。
此问题将在 cxf 3.3.0 中得到解决 (https://issues.apache.org/jira/browse/CXF-7852)
目前,您可以运行 mvn install在https://github.com/apache/cxf的mvn-plugins目录下构建插件,并将pom中的版本设置为3.3.0-快照
编辑: 插件在 apache 快照存储库中,所以从那里获取它可能更好:
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Maven Plugin Snapshots</name>
<url>http://repository.apache.org/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.3.0-SNAPSHOT</version>
...
注意(2019-01-28):插件现在released,我们可以照常添加依赖:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.3.0</version>
<type>maven-plugin</type>
</dependency>
我也在努力让插件与 Java 11 一起工作。 尝试详细说明插件依赖关系以解决问题:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>3.2.3</version>
<dependencies>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<!-- Java Architecture for XML Binding (JAXB), Java 11+ support -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<!-- JavaBeans Activation Framework (JAF), Java 11+ support -->
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>${jaf-api.version}</version>
</dependency>
<!-- Java API for XML Web Services (JAX-WS), Java 11+ support -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>${jaxws-api.version}</version>
</dependency>
</dependencies>
</plugin>
.. 运气不好。 当我升级到插件的 3.2.3 版本时,问题就消失了 (在等待 3.3.0 时,如此处所述:https://issues.apache.org/jira/browse/CXF-7852)。