[闭月羞花猫]项目中,最简单的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} " />
<echo message= "user.home = ${user.home} " />
<tstamp>
<format property= "year " pattern= "yyyy " />
<format property= "date " pattern= "yyyy/MM/dd " />
</tstamp>
</target>
<!-- Remove directory -->
<target name= "clean " depends= "init " description= "Delete old build and dist directories ">
<delete dir= "${src.output.dir} " />
<delete dir= "${web.output.dir} " />
</target>
<!-- Create directory -->
<target name= "prepare " depends= "init ">
<mkdir dir= "${src.output.dir} " />
<mkdir dir= "${web.output.dir} " />
</target>
<!-- CopySource to output Directory -->
<target name= "copy " depends= "prepare ">
<copy todir= "${src.output.dir} ">
<fileset dir= "${src.all.dir} " />
</copy>
<copy todir= "${web.output.dir} ">
<fileset dir= "${web.all.dir} " excludes= "**/*.class " />
</copy>
<delete dir= "${web.output.dir}\WEB-INF\classes " />
<mkdir dir= "${web.output.dir}\WEB-INF\classes " />
</target>
<!-- Compile -->
<target name= "compile " depends= "copy " description= "Compile sources ">
<javac destdir= "${compile.target.dir} " srcdir= "${src.output.dir} " source= "1.4 " target= "1.4 ">
<include name= "**/*.java " />
<classpath refid= "compile.classpath " />
</javac>
<copy todir= "${web.output.dir}\WEB-INF\classes ">
<fileset dir= "${src.output.dir} " includes= "**/*.properties " />
</copy>
<delete file= "${web.output.dir}/WEB-INF/lib/servlet.jar " />
</target>
<!--Make War -->
<target name= "war " description= "Make war ">
<jar destfile= "./project.war " basedir= "${web.output.dir} " />
</target>
<!-- Make Jar
<target name= "jar " description= "Make jar "> <jar destfile= "./project.jar " basedir= "${compile.target.dir} "/>
</target>
-->
<target name= "mkwar " depends= "init, clean, prepare, copy, compile, war " />
</project>
[解决办法]
顶!
[解决办法]
顶你来了.
[解决办法]
猫,把你msn留下给我!