ant and ivy

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>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值