| Apache CXF Documentation > Index > Tools > Ant Tasks |
CXF provides ant tasks for wsdl2java and java2ws.
The tasks are delivered in a separate jar file: modules/integration/cxf-anttasks-2.1.jar.
Here is a snippet from the wsdl_first_anttask sample provided in the CXF distribution. It shows the declaration of the task jar file via the ant 'antlib' mechanisms, and the use of the wsdl2java task.
<project name="hello world demo" default="build" basedir="." xmlns:cxf="antlib:org.apache.cxf.ant.extensions" > <import file="../common_build.xml"/> <path id='cxf.anttasks.classpath'> <pathelement location='${cxf.home}/modules/integration/cxf-anttasks-2.1.jar'/> <path refid='cxf.classpath'/> </path> <taskdef uri="antlib:org.apache.cxf.ant.extensions" resource="org/apache/cxf/ant/extensions/antlib.xml" classpathref="cxf.anttasks.classpath"/> <target name="generate.code"> <echo level="info" message="Generating code using wsdl2java..."/> <mkdir dir="${build.src.dir}"/> <mkdir dir="${build.classes.dir}"/> <cxf:wsdl2java wsdl="${wsdl.dir}/hello_world.wsdl" sourceDestDir="${build.src.dir}" destDir="${build.classes.dir}"/> </target> </project>
Note you may always use the Ant <java/> task directly instead and with the same options as available with the command-line wsdl2java
and java2ws
(CXF 2.1) or java2wsdl
(CXF 2.0.x) options. Examples of such usage are on the tools' respective pages.