ant build 项目实例

<project name="MyWebApplication" basedir="." default="coop" >
 <!--
   - 
   - SETUP ENVIRONMENT VARIABLES FOR THE BUILD
   -
   -->
 <property file="build_ODC.properties"/>
 
 <property name="build"   value="${build.dir}"/>
 <property name="deploy"   value="${dest.dir}"/>
 <property name="compile.debug"   value="true"/>
 <property name="version.num" value="1.00"/>
 <buildnumber file="build.num"/>
 <tstamp>
  <format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
 </tstamp>
 <manifest file="MANIFEST.MF">
  <!--<attribute name="Main-Class" value="${Main-Class}"/> if any main class needs to be defined-->
  <attribute name="Implementation-Title" value="${coop.package.name} (${coop.repository})" />
  <attribute name="Implementation-Version"
  value="${version.num}-b${build.number}"/>  
  <attribute name="Built-Date" value="${TODAY}"/>  
 </manifest>

 
 <!--
   - 
   - SETUP INCLUDE CLASSES; THIS IS WHERE WE WILL DEFINE WHAT CLASSES WILL
   - BE INCLUDED IN EACH OF OUR JAR FILES
   - 
   -->

 
 <!--
   - 
   - DEFINE OUR CLASSPATH
   - 
   -->

 <path id="build.class.path">
  <fileset dir="${lib.shared.dir}">
   <include name="**/*.jar" />
  </fileset>
 </path>
   
 <!--
   - 
   - BUILD OPTIONS: ejb.jar, ejb.jar.clean
   - 
   -->
 
  <!-- ===================================== -->
  <!--           Build the EJB JAR file      -->
  <!-- ===================================== -->                 
 

 

 <target name="coop" depends="compile">
  <jar jarfile="${package.file.jar}" manifest="MANIFEST.MF" update="true" >
  <fileset dir="${build.dir}"
  includes="**/*"/>
  
  
  <fileset dir="${workingdir}/META-INF"
  includes="${workingdir}/META-INF/**/*" />
  </jar>
 </target>

  <target name="coop.clean" depends="compile.clean,coop" />

 <!--
   - 
   - COMPILATION OPTIONS: compile, compile.clean
   - 
   -->
    <!-- ===================================== -->
  <!--           Compile                     -->
  <!-- ===================================== -->
 <!--
  Compilation Step: Compiles all of the files defined in the src property
  -->
 
 <target name="compile" depends="prepare">
  <!-- Compile the java code from ${src.dir} into ${build.dir} -->
  <echo message="Compiling source code..." />
  <javac srcdir="${workingdir}"                   
   destdir="${build.dir}" includes="**/*" debug="${compile.debug}">                
   <classpath refid="build.class.path" />
  </javac>
  <copy todir="${build.dir}/META-INF">
  <fileset dir="${workingdir}/META-INF">
   <include name="**/*.xml"/>
  </fileset>
  </copy>
 </target>

 <!--
  Perform a clean compilation
  --> 
 <target name="compile.clean" depends="clean,prepare,compile" />
 <!--
   - 
   - SETUP OPTIONS: clean, prepare
   - 
   -->

 <!--
  Prepare performs setup steps for the build
  -->   
          
 <target name="prepare" depends="clean">
 <!-- Create the time stamp -->
  <tstamp/>
  
  <!-- Create the build directory structure used by compile -->
  <mkdir dir="${build.dir}" />
  <mkdir dir="${dest.dir}" />
  <mkdir dir="${build.dir}/META-INF"/>
 </target>
 
 <!--
  Clean everything
  -->         
               
 <target name="clean">
 <!-- Delete the ${build.dir} and ${jar.dir} directory trees -->
  <delete dir="${build.dir}" />
  <delete dir="${dest.dir}" />
  <delete dir="${build.dir}/META-INF"/>
 </target>

</project>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值