For some oddball reason (I don't really know why), by default, the tools stuff 
doesn't call System.exit(1) in the event of a failure.  I'm hesitant to change 
the default for 2.2.x as it might suddenly start breaking peoples builds and 
such, but possibly for 2.3.  I'd need to dig more.

You can make it do so by adding:
 <sysproperty key="exitOnFinish" value="true"/>

Dan


On Friday 12 March 2010 3:40:03 pm Kessel, Christopher wrote:
> I'm using CXF 2.2.6. I'm trying to integrate the java2ws into our ant
> build. It runs, but on failure it's not causing the build to fail.
> Here's the ant target:
> 
>     <target name="create-wsdl">
>         <java failonerror="true"
> classname="org.apache.cxf.tools.java2ws.JavaToWS" fork="true">
>             <arg value="-verbose"/>
>             <arg value="-wsdl"/>
>             <arg value="-o"/>
>             <arg value="${build.dir}/schemas/v50/cl_50.wsdl"/>
>             <arg value="foo.MyTest"/>
>             <classpath>
>                 <pathelement location="${build.prod.dir}" />
>                 <fileset dir="${build.lib.dir}">
>                     <include name="*.jar"/>
>                 </fileset>
>             </classpath>
>         </java>
>     </target>
> 
> Below is the failure from the ant logs (purposefully caused by
> preventing MyTest from being in the classpath), but it's not being seen
> by Ant as a failure. Is there some trick I'm missing to get the java2ws
> target to return an error code? I only dabble in Ant very sporadically,
> so maybe it's an Ant thing I'm missing?
> 
> Thanks,
> Chris
> 
> 
> java2ws -verbose -wsdl -o
> C:\snapshots\cip\c360p1/build/schemas/v50/cl_50.wsdl foo.MyTest
> java2ws - Apache CXF 2.2.6
> 
> JavaToWS Error: org.apache.cxf.tools.common.ToolException: Fail to load
> class : foo.MyTest
> 
> org.apache.cxf.tools.common.ToolException: Fail to load class :
> foo.MyTest
>       at
> org.apache.cxf.tools.util.AnnotationUtil.loadClass(AnnotationUtil.java:8
> 3)
>       at
> org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.getServiceC
> lass(JavaToWSDLProcessor.java:307)
>       at
> org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.getServiceB
> uilder(JavaToWSDLProcessor.java:204)
>       at
> org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.process(Jav
> aToWSDLProcessor.java:127)
>       at
> org.apache.cxf.tools.java2ws.JavaToWSContainer.processWSDL(JavaToWSConta
> iner.java:109)
>       at
> org.apache.cxf.tools.java2ws.JavaToWSContainer.execute(JavaToWSContainer
> .java:75)
>       at
> org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:
> 103)
>       at
> org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:
> 58)
>       at
> org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:
> 40)
>       at org.apache.cxf.tools.java2ws.JavaToWS.run(JavaToWS.java:77)
>       at org.apache.cxf.tools.java2ws.JavaToWS.main(JavaToWS.java:45)
> Caused by: java.lang.ClassNotFoundException: foo.MyTest
>       at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>       at
> org.apache.cxf.tools.util.AnnotationUtil.loadClass(AnnotationUtil.java:8
> 0)
>       ... 10 more
> 
> Ant build completed with 22 warnings in 2s at 12:24:11 PM

-- 
Daniel Kulp
dk...@apache.org
http://dankulp.com/blog

Reply via email to