日期:2014-05-20  浏览次数:20769 次

[闭月羞花猫]项目中,最简单的build.xml文件的书写方式
闲来无事,写了几篇关于web开发过程中,一些基础的应用。
希望能够对初学者有所帮助。

不足的地方,也希望高手能够给与指正。

项目中,最简单的build.xml文件的书写方式。
项目source目录。

project
        -   src
        -   web
ant
        -   ant.bat
        -   bulid.xml
        -   project.war (编译出来的war   的位置)
====================================================================================================================================

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

<!--
    #   $Id:   build.xml,v   1.4   2005/11/17   07:25:33   luyang   Exp   $
    #
    #   Copyright   (C)     All   Rights   Reserved.
-->

<project   name= "Project   Build "   default= "makewar "   basedir= ". ">

  <!--   ==========   Prerequisite   Properties   ===========   -->
  <property   file= "./common.properties "   />

  <!--   Set   the   properties   for   source   directories   -->
  <property   name= "src.all.dir "   value= "../project/src "   />
  <property   name= "web.all.dir "   value= "../project/web "   />

  <property   name= "src.output.dir "   value= "./dist/src "   />
  <property   name= "web.output.dir "   value= "./dist/web "   />

  <!--   Compile   Libraries   directory   -->
  <property   name= "compile.lib.dir "   value= "${web.output.dir}/WEB-INF/lib "   />
  <property   name= "compile.target.dir "   value= "${web.output.dir}/WEB-INF/classes "   />

  <!--   Compilation   Classpath   -->
  <path   id= "compile.classpath ">
    <fileset   dir= "${compile.lib.dir} ">
      <include   name= "**/*.jar "   />
    </fileset>
  </path>


  <!--   ==========   Executable   Targets   ==============   -->


  <!--
                The   "init "   target   evaluates   "available "   expressions   as   necessary
                to   modify   the   behavior   of   this   script   and   print   some   information   on
                screen
  -->
  <target   name= "init ">
    <echo   message= "---------   ${project.name}   ${project.version}   --------- "   />
    <echo   message= " "   />
    <echo   message= "java.class.path   =   ${java.class.path} "   />
    <echo   message= "java.home               =   ${java.home} "   />