关闭

build.xml

1173人阅读 评论(0) 收藏 举报

<?xml version="1.0" encoding="utf-8"?>

<project default="usage" name="wap_build" basedir=".">

  <!-- =================================================================== -->
  <!-- Initialization target                                               -->
  <!-- =================================================================== -->
  <target name="init">
    <tstamp/>
    <property file="${basedir}/build.properties" />
    <property name="Name" value="wap_build"/>
    <property name="namedir" value="./"/>
 <property name="jsdk_jar" value="${jsdk_jar}" />
    <property name="version" value="1.0"/>
    <property name="year" value="2005"/>
    <echo message="----------- ${Name} ${version} [${year}] ------------"/>
    <property name="debug" value="off"/>
    <property name="optimize" value="on"/>
    <property name="deprecation" value="on"/>
    <property name="src.dir" value="./src"/>
    <property name="lib.dir" value="./WEB-INF/lib"/>
    <property name="packages" value="com.chedong.*,org.apache.lucene.*"/>
    <property name="build.src" value="./src"/>
    <property name="build.dest" value="./WEB-INF/classes"/>
    <property name="build.javadocs" value="./src/doc"/>

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

    <filter token="year" value="${year}"/>
    <filter token="version" value="${version}"/>
    <filter token="date" value="${TODAY}"/>
    <filter token="log" value="true"/>
    <filter token="verbose" value="true"/>
  </target>

  <!-- =================================================================== -->
  <!-- Help on usage                                                       -->
  <!-- =================================================================== -->
  <target name="usage" depends="init">
    <echo message="${Name} Build file"/>
    <echo message="-------------------------------------------------------------"/>
    <echo message=""/>
    <echo message=" available targets are:"/>
    <echo message=""/>
    <echo message="   jar      --> generates the ${name}.jar file"/>
    <echo message="   build    --> compiles the source code"/>
    <echo message="   javadoc  --> generates the API documentation"/>
    <echo message="   clean    --> cleans up the directory"/>
    <echo message=""/>
    <echo message=" Please rename build.properties.default to build.properties"/>
    <echo message=" and edit build.properties to specify JSDK 2.3 classpath."/>
    <echo message=""/>
    <echo message=" See the comments inside the build.xml file for more details."/>
    <echo message="-------------------------------------------------------------"/>
    <echo message=""/>
    <echo message=""/>
  </target>

  <!-- =================================================================== -->
  <!-- Prepares the source code                                            -->
  <!-- =================================================================== -->
  <target name="prepare-src" depends="init">
    <!-- create directories -->
    <mkdir dir="${build.src}"/>
    <mkdir dir="${build.dest}"/>

    <!-- copy src files -->
    <copy todir="${build.src}">
      <fileset dir="${src.dir}"/>
    </copy>
  </target>

  <!-- =================================================================== -->
  <!-- Compiles the source directory                                       -->
  <!-- =================================================================== -->
  <target name="build" depends="prepare-src">
    <javac srcdir="${build.src}"
           destdir="${build.dest}"
           debug="${debug}"
           optimize="${optimize}">
      <classpath refid="classpath"/>
    </javac>
  </target>

  <!-- =================================================================== -->
  <!-- Creates the class package                                           -->
  <!-- =================================================================== -->
  <target name="jar" depends="build">
      <delete file="${lib.dir}/web-${year}-${version}.jar" />
  <jar destfile="${lib.dir}/web-${year}-${version}.jar">
   <fileset dir="${build.dest}">
    <include name="**/*.class" />
    <exclude name="**/ejb/*Bean.class" />
   </fileset>
   <fileset dir="${src.dir}">
    <include name="**/*" />
    <exclude name="**/*.java" />
   </fileset>
      </jar>
  </target>

  <!-- =================================================================== -->
  <!-- Creates the API documentation                                       -->
  <!-- =================================================================== -->
  <target name="javadoc" depends="build">
    <mkdir dir="${build.javadocs}"/>
    <javadoc packagenames="${packages}"
             sourcepath="${build.src}"
             destdir="${build.javadocs}"
             author="true"
             version="true"
             use="true"
             splitindex="true"
             windowtitle="${Name} API"
             doctitle="${Name}">
      <classpath refid="classpath"/>
    </javadoc>
  </target>


    <!--  War-file Make -->
    <target depends="jar" name="war">
      <delete file="${name}/${name}.war" />
  <war warfile="${name}/${name}.war"
       webxml="${basedir}/WEB-INF/web.xml"
       filesonly="yes">
   <fileset dir="${basedir}">
    <include name="**/*" />
    <exclude name="WEB-INF/web.xml" />
   </fileset>
   <classes dir="${src.dir}">
    <include name="**/*" />
    <exclude name="**/*.java" />         
   </classes>
   <!--classes dir="${src.dir}">
    <exclude name="**/*.java" />
    <exclude name="**/package.html" />
   </classes-->

  </war>
     </target>


  <!-- =================================================================== -->
  <!-- Clean targets                                                       -->
  <!-- =================================================================== -->
  <target name="clean" depends="init">
    <delete dir="${build.src}"/>
    <delete dir="${build.dest}/org"/>
    <delete dir="${build.dest}/com"/>
    <delete>
      <fileset dir="${build.dest}" includes="**/*.class"/>
    </delete>
  </target>

    <target name="compile-src"
         depends="init"
         description="Compile all classes.">
  <javac deprecation="yes"
         debug="yes"
         srcdir="${src.dir}"
         destdir="${build.dest}"
         source="1.4"
         target="1.4">
   <classpath refid="compile.classpath" />
  </javac>
 </target>

</project>

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:42306次
    • 积分:669
    • 等级:
    • 排名:千里之外
    • 原创:21篇
    • 转载:1篇
    • 译文:0篇
    • 评论:2条
    最新评论