1
我想在我的Ant構建文件中使用WSDLToJava
的Apache CXF來從WSDL創建Java代碼。依賴關係使用Ivy解決。我總是得到以下錯誤:爲什麼這個CXF WSDLToJava的Ant/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,螞蟻1.8,常春藤2.2.0螞蟻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安裝的所有罐子的類路徑。如果我這樣做,它的工作。
在構建我看到以下的輸出:
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
謝謝,我只需要'cxf-tools-wsdlto -frontend-jaxws'和'cxf-tools-wsdlto-databinding-jaxb' – 2011-03-09 14:03:47