Why this Ant/Ivy integration of CXF WSDLToJava does not work?
I would like to use WSDLToJava
of Apache CXF in my Ant buildfile to create Java code from a WSDL. The dependencies are resolved using Ivy. I always get the following error:
WSDLToJava Error: Could not find jaxb databinding within classpath
I do not have an installation and want to use Ivy to do the job for me. Here is the part of my Ant buildfile:
<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&开发者_如何学Gogt;
I use Java 6, Ant 1.8, Ivy 2.2.0 ant CXF 2.2.12. In the Ivy module I configured the following:
<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>
Where is the problem? Maybe there is a dependency missing, but which one? Without Ivy, the Ant integration uses a classpath with all jars of the CXF installation. If I do so, it works.
In the output of the build I see the following:
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
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.
精彩评论