1.download ant
2.download ivy
3.copy ivy jar to ant's lib
4.set ant home in eclipse>window>referance>ant
5.add several sections as follow into build.xml
6.add ivy.xml as follow
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. -->
<project name="JaxwsHotel" default="war" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
Web Services build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src" />
<property name="build" location="build" />
<property name="dist" location="dist" />
<property name="webcontent" location="WebContent" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<mkdir dir="${dist}" />
</target>
<!-- =================================
target: resolve
================================= -->
<target name="resolve" description="--> retreive dependencies with ivy">
<ivy:retrieve pattern="libsources/[artifact]-[type].[ext]" type="source" />
<ivy:retrieve pattern="lib/[artifact].[ext]" type="jar" />
</target>
<!-- =================================
target: report
================================= -->
<target name="report" depends="resolve" description="--> generates a report of dependencies">
<ivy:report todir="${build.dir}"/>
</target>
<path id="classpath">
<pathelement location="lib/jaxb-xjc.jar" />
<pathelement location="lib/javaee.jar" />
</path>
<echo message="start generating java classes" />
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
<classpath refid="classpath" />
</taskdef>
<target name="xjc">
<!--xjc schema="simpleTest.xsd" package="com.objectiva.JAXBTesting.book"/-->
<xjc schema="Customer.xsd" package="ws.server.hotel.model" />
</target>
<!--<target name="compile" depends="init,resolve,xjc" description="compile the source ">-->
<target name="compile" depends="init,xjc" description="compile the source ">
<!-- Compile the java code from ${src} into ${build} -->
<javac debug="true" debuglevel="lines,vars,source" includeantruntime="on" srcdir="${src}" destdir="${build}" />
</target>
<target name="war" depends="compile" description="generate the distribution war">
<!-- Create the war distribution directory -->
<mkdir dir="${dist}/war" />
<!-- Follow standard WAR structure -->
<copydir dest="${dist}/war/build/WEB-INF/" src="${webcontent}/WEB-INF/" />
<copydir dest="${dist}/war/build/WEB-INF/classes/" src="${build}" />
<copyfile dest="${dist}/war/build/WEB-INF/classes/soapHandler.xml" src="soapHandler.xml" />
<!--<jar jarfile="${dist}/war/JaxwsHotel-${DSTAMP}.war" basedir="${dist}/war/build/" />-->
<jar jarfile="F:/Kevin/tools/apache-tomcat-6.0.35-windows-x86/apache-tomcat-6.0.35/webapps/JaxwsHotel.war" basedir="${dist}/war/build/" />
</target>
</project>
ivy.xml
<ivy-module version="2.0">
<info organisation="org.apache" module="hello-ivy"/>
<dependencies>
<dependency org="commons-lang" name="commons-lang" rev="2.0"/>
<dependency org="commons-cli" name="commons-cli" rev="1.0"/>
<dependency org="com.sun.jdmk" name="jmxtools" rev="1.2.1"/>
</dependencies>
</ivy-module>