ant - build.xml - summary

build.properties
delete.dir=d\:\\Resources\\SSH完成项目\\crm_grails

build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="ant" default="dist" basedir=".">
        <description>
            simple ant build file
        </description>
        <!-- set global properties for this build -->
       <property file="build.properties"></property>
        <property name="src" location="src"></property>
        <property name="build" location="build"></property>
        <property name="dist" location="dist"></property>
        
    <target name="init">
        <!-- Create the time stamp -->
        <tstamp/>
        <!-- Create the build directory structure by compile -->
        <mkdir dir="${build}"/>
    </target>
    
    <target name="compile" depends="init" description="compile the source">
        <!-- Compile the java code from ${src} into ${build} -->
        <javac srcdir="${src}" destdir="${build}"></javac>
    </target>
    
    <target name="dist" depends="compile" description="generate the distribution">
        <!-- Create the distribution directory -->
        <mkdir dir="${dist}/lib"/>
        <!-- Put everything in ${build} into the ant -${DSTAMP}.jar file -->
        <jar jarfile="${dist}/lib/ant-${DSTAMP}.jar"  basedir="${build}">
            <manifest>
                <attribute name="Built-By" value="RayooTech"/>
                <attribute name="Main-Class" value="cn.ant.test.TestOut"/>
            </manifest>
        </jar>
    </target>
    
    <target name="clean" description="clean up">
        <!-- Delete the ${build} and ${dist} directory trees -->
        <delete dir="${build}"/>
        <delete dir="${dist}"/>
    </target>
    
   <target name="javadoc" description="generate the javadoc">
       <mkdir dir="docs/api"/>
       <javadoc packagenames="cn.ant.*"
                     sourcepath="src"
                     excludepackagenames="cn.ant.other.*"
                     defaultexcludes="yes"
                     destdir="docs/api"
                     author="true"
                     version="true"
                     use="true"
                     windowtitle="RayooTech API">
              <doctitle><![CDATA[<h1>Ant_Test</h1>]]></doctitle>
              <bottom><![CDATA[<i>Copyright &#169; 2011 Ant_Test. All Rights Reserved.</i>]]></bottom>
              <tag name="todo" scope="all" description="To do:"/>
              <group title="Group 1 Packages" packages="cn.ant.test.Test1*"/>
              <group title="Group 2 Packages" packages="cn.ant.test2.Test3*"/>
              <link offline="true" href="http://rayoo.iteye.com" packagelistLoc="C:\tmp"/>
              <link href="http://blog.163.com/rayoo_tech"/>
            </javadoc>
   </target>
    
    <target name="copy" description="copy task">
        <mkdir dir="${dist}/docs"/>
        <copy toDir="${dist}/docs">
              <fileset dir="docs">
                <include name="**/*.html"/>
              </fileset>
              <filterset begintoken="%" endtoken="*">
                <filtersfile file="${user.dir}/dist.properties"/>
              </filterset>
         </copy>
    </target>

    <target name="initdb" description="initialize the mysql db">
        <sql
            driver="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost/test"
            userid="root"
            password="root"
            src="data.sql" >
            <classpath>
                <pathelement location="lib/mysql-connector-java-5.1.3-rc-bin.jar"/>
            </classpath>
        </sql>
    </target>
    
    <target name="delsvn" description="delete the svn files in the project">
        <delete includeemptydirs="true">
            <fileset dir="${delete.dir}" includes="**/.svn/**" defaultexcludes="false"/>
          </delete>
    </target>
</project>

其它build.xml见附件:

你可能感兴趣的:(build.xml)