为什么 CXF WSDLToJava 的 Ant/Ivy 集成不起作用?
我想在我的 Apache CXF 的 WSDLToJava
://ant.apache.org/" rel="nofollow">Ant 构建文件,用于从 WSDL 创建 Java 代码。使用 Ivy 解决依赖关系。我总是收到以下错误:
WSDLToJava Error: Could not find jaxb databinding within classpath
我没有安装,想使用 Ivy 来帮我完成这项工作。这是我的 Ant 构建文件的一部分:
<target name="generate" depends="init">
<ivy:retrieve conf="build"/>
<mkdir dir="${basedir}/target/generated"/>
<ivy:cachepath pathid="build-classpath" conf="build"/>
<java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true">
<arg value="-d"/>
<arg value="${basedir}/target/generated"/>
<arg value="-client"/>
<arg value="${basedir}/src/schema/MyWebService.wsdl"/>
<classpath refid="build-classpath"/>
</java>
</target>
我使用 Java 6、Ant 1.8、Ivy 2.2.0 ant CXF 2.2.12。在ivy模块中我配置了以下内容:
<configurations>
<conf name="build" visibility="private"/>
...
</configurations>
<dependencies defaultconfmapping="*->default">
<dependency org="org.apache.cxf" name="cxf-tools-wsdlto-frontend-jaxws" rev="2.2.12" conf="build"/>
<dependency org="org.apache.cxf" name="cxf-rt-databinding-jaxb" rev="2.2.12" conf="build"/>
...
</dependencies>
问题出在哪里?也许缺少一个依赖项,但是是哪一个呢?如果没有 Ivy,Ant 集成将使用包含 CXF 安装的所有 jar 的类路径。如果我这样做,它就会起作用。
在构建的输出中我看到以下内容:
generate (2s)
[generate] ivy:retrieve (1s)
[ivy:retrieve] :: resolving dependencies :: me#mine;1.0
[ivy:retrieve] confs: [build]
[ivy:retrieve] found org.apache.cxf#cxf-tools-wsdlto-frontend-jaxws;2.2.12 in public
[ivy:retrieve] found org.apache.cxf#cxf-tools-common;2.2.12 in public
[ivy:retrieve] found oro#oro;2.0.8 in public
[ivy:retrieve] found wsdl4j#wsdl4j;1.6.2 in public
[ivy:retrieve] found com.sun.xml.bind#jaxb-xjc;2.1.13 in public
[ivy:retrieve] found com.sun.xml.bind#jaxb-impl;2.1.13 in public
[ivy:retrieve] found javax.xml.bind#jaxb-api;2.1 in public
[ivy:retrieve] found javax.xml.stream#stax-api;1.0-2 in public
[ivy:retrieve] found javax.xml.soap#saaj-api;1.3 in public
[ivy:retrieve] found org.apache.cxf#cxf-api;2.2.12 in public
[ivy:retrieve] found org.apache.cxf#cxf-common-utilities;2.2.12 in public
... (many more)
[ivy:retrieve] :: retrieving :: me#mine
[ivy:retrieve] confs: [build]
[ivy:retrieve] 32 artifacts copied, 28 already retrieved (8959kB/38ms)
[generate] mkdir
[mkdir] Created dir: /tmp/target/generated
[generate] java (1s)
[java] WSDLToJava Error: Could not find jaxb databinding within classpath
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能还需要一个
cxf-tools-wsdlto-databinding-jaxb
依赖项。由于多种原因,JAXB 的工具和运行时是分开的。There is a
cxf-tools-wsdlto-databinding-jaxb
dependency that you likely need as well. For a variety of reasons, the tooling and runtime are separate for JAXB.