Ant build file written in the previous project

Source: Internet
Author: User
Tags copy include mail mkdir zip
Project one, the previous project written, you can compile, automated testing, packaging Build.xml

<?xml version= "1.0"?>
<project name= "Simulatorel" basedir= "." default= "All" >
<!--edit by Yanghuawei-->

<property name= "Build.dir" value= "Classes"/>
<property name= "Lib.dir" value= "Lib"/>
<property name= "Dist.dir" value= "dist"/>
<property name= "Source.dir" value= "/simulatorel/src"/>
<property name= "Testsrc.dir" value= "/simulatorel/test"/>

Name= "Report.dir" value= "<property"/>
<property name= "Report_html.dir" value= "${report.dir}/html"/>

<property name= "Cvs.repository" value= ":p server:yanghw:cvs@localhost:/usr/local/cvsroot"/>
<property name= "Cvs.package" value= "Simulatorel"/>

<property name= "common.src" value= "common"/>
<property name= "Common.class" value= "Commonclass"/>

<property name= "Release_ap.dir" value= "Simap/simulatorel/ap"/>

<path id= "Project.classpath" >
<fileset dir= "${lib.dir}" >
<include name= "**/*.jar"/>
</fileset>
<pathelement path= "${build.dir}"/>
</path>

<target name= "Init" description= "Prepare for Build" >
<mkdir dir= "${build.dir}"/>
<mkdir dir= "${dist.dir}"/>
<!--mkdir dir= "${logdir}"/-->
<!--mkdir dir= "${report.dir}"/-->
<mkdir dir= "${report_html.dir}"/>
</target>

<target name= "clean" description= "clean all builds Products" >
<delete dir= "${build.dir}" quiet= "true"/>
<delete dir= "${dist.dir}" quiet= "true"/>
<delete dir= "Simulatorel" quiet= "true"/>
<delete dir= "${report.dir}" quiet= "true"/>

<delete dir= "${common.class}" quiet= "true"/>
</target>

<target name= "Compile" depends= "Init,checkout,common_build" description= "Compile Application" >
<javac srcdir= "${source.dir}" destdir= "${build.dir}" encoding= "EUC-JP"
Includes= "**/*.java" debug= "on" deprecation= "on" >
<classpath refid= "Project.classpath"/>
</javac>
</target>

<target name= "Compile_test" depends= "compile" description= "compile the classes of test" >
<javac srcdir= "${testsrc.dir}" destdir= "${build.dir}" encoding= "EUC-JP"
Includes= "**/*.java" debug= "on" deprecation= "on" >
<classpath refid= "Project.classpath"/>
</javac>
</target>

<target name= "test" depends= "Compile_test" description= "Run unit Tests" >
<!--delete dir= "${junit.results}"/>
<mkdir dir= "${junit.results}"/-->
<tstamp/>
<junit fork= "yes" haltonfailure= "no" >
<jvmarg value= "-duser.dir=/home/docomo/simbuild/simulatorel"/>
<classpath refid= "Project.classpath"/>
<formatter type= "xml" usefile= "true"/>
<!--formatter type= "xml"/-->
<batchtest todir= "${report.dir}" >
<fileset dir= "${build.dir}" includes= "**/*test.class"/>
</batchtest>
</junit>

<junitreport todir= "${report.dir}" >
<fileset dir= "${report.dir}" >
<include name= "Test-*.xml"/>
</fileset>
<report format= "Frames" todir= "${report_html.dir}"/>
</junitreport>
<jar jarfile= "${report.dir}/simulatoreltestreport-${dstamp}-${tstamp}.zip" basedir= "${report_html.dir}"/>
</target>


<target name= "Mail" depends= "Test" >
<mail mailhost= "192.168.98.1" subject= "Test" >
<from address= "yanghw@sz.cathay.jp"/>
<to address= "docomo-dev@sz.cathay.jp"/>
<message>the Nightly Build/test has completed</message>
<fileset dir= "${report.dir}" >
<include name= "*.zip"/>
</fileset>
</mail>
</target>

<target name= "Common_build" description= "Build Common module" >
<!--checkout common module from CVS-->
<delete dir= "${common.src}" quiet= "true"/>
<cvs cvsroot= "${cvs.repository}" package= "Common" dest= "." />

<!--compile and jar the common module-->
<mkdir dir= "${common.class}"/>
<javac srcdir= "${cttcommsrc}" destdir= "${common.class}" excludes= "**/*test.java" encoding= "EUC-JP" >
<classpath refid= "Project.classpath"/>
</javac>
<delete file= "${lib.dir}/common.jar" quiet= "true"/>
<jar jarfile= "${lib.dir}/common.jar" basedir= "${common.class}"/>
</target>

<target name= "tar" depends= "Compile,jar" description= "creates a tar archive" >
<delete dir= "Simap" quiet= "true"/>
<mkdir dir= "${release_ap.dir}/src"/>
<mkdir dir= "${release_ap.dir}/conf"/>
<mkdir dir= "${release_ap.dir}/lib"/>
<!--mkdir dir= "simap/simulatorel/ap/conf"/-->

<copydir src= "${source.dir}" dest= "${release_ap.dir}/src" includes= "**/*.java"/>

<copydir src= "simulatorel/config/simulatorel/ap/conf" dest= "${release_ap.dir}/conf"/>

<!--copydir src= "simulatorel/images" dest= "Simap/simulatorel/ap/conf/images"/-->

<copy file= "${dist.dir}/simulatorel.jar" todir= "${release_ap.dir}/lib"/>

<copy todir= "${release_ap.dir}/lib" >
<fileset dir= "${lib.dir}" >
<include name= "Emsutil.jar"/>
<include name= "Common.jar"/>
</fileset>
</copy>

<tar tarfile= "${dist.dir}/simulatorel.tar" basedir= "Simap"/>
<gzip zipfile= "${dist.dir}/simulatorel.tar.gz" src= "${dist.dir}/simulatorel.tar"/>
</target>

<target name= "Jar" >
<jar jarfile= "${dist.dir}/simulatorel.jar" >
<fileset dir= "${build.dir}" >
<exclude name= "**/*test*"/>
</fileset>
</jar>
</target>

<target name= "Checkout" description= "Update package from CVS" >
<cvs cvsroot= "${cvs.repository}" package= "${cvs.package}" dest=. " />
</target>

<target name= "All" depends= "Clean,mail,tar" description= "Build Application"/>

</project>

Second, write a shell file under Linux autotest.sh

CD ~/build

SOURCE ~/.docomo.profile

Ant Mail

Third, add to the crontab, automatically run every day

# CRONTAB-E

4 9 * * */home/docomo/build/autotest.sh

Use of crontab see articles for collections



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.