·您的位置: 首页 » 资源教程 » 编程开发 » JAVA、JSP » 一个 ANT 工程文件的示例

一个 ANT 工程文件的示例

类别: JSP教程  评论数:0 总得分:0
下面是一个 ANT 工程文件的示例 build.xml,供大家参考。更多的使用方法请参阅 ANT 自带的文档。

<?xml version="1.0"?>
<project default="dist" basedir=".">
<property name="name" value="bbs"/>
<property name="version" value="1"/>
<property name="year" value="2002"/>
<property name="language" value="en"/>
<!--
Give user a chance to override without editing this file
(and without typing -D each time he compiles it)
-->
<property file=".ant.properties"/>
<property file="${user.home}/.ant.properties"/>
<!--
There should be no need to override default compiler but need to change
javac task to run without this
-->

<property name="build.compiler" value="jikes"/>
<!--
<property name="build.compiler" value="classic"/>
-->

<!--
these are here only for those who use jikes compiler. For other
developers this part makes no difference.
-->
<property name="build.compiler.emacs" value="on"/>
<property name="build.compiler.pedantic" value="true"/>
<property name="build.compiler.depend" value="true"/>
<property name="build.compiler.fulldepend" value="true"/>

<property name="debug" value="on"/>
<property name="optimize" value="off"/>
<property name="deprecation" value="off"/>

<!--
===================================================================
Set the properties for intermediate directory
===================================================================
-->
<property name="build.dir" value="build"/>
<property name="build.classes" value="${build.dir}/classes"/>
<property name="build.webapps" value="${build.dir}/webapps"/>

<property name="dist.dir" value="dist"/>
<property name="dist.classes" value="${dist.dir}/WEB-INF/classes"/>
<property name="src.dir" value="src"/>
<property name="classes.dir" value="${src.dir}/classes"/>
<property name="webapps.dir" value="${src.dir}/webapps"/>

<path id="project.class.path">
<pathelement path="${java.class.path}" />
<pathelement path="${build.classes}" />
</path>

<!-- =================================================================== -->
<!-- Help on usage -->
<!-- =================================================================== -->
<target name="usage">
<echo message=""/>
<echo message=""/>
<echo message="xiaoyoung BBS Build file"/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=" available targets are:"/>
<echo message=""/>
<echo message=" compile --> compiles the source code"/>
<echo message=" dist --> generates the distribution, packed"/>
<echo message=" clean --> cleans up the directory"/>
<echo message=""/>
<echo message=" See the comments inside the build.xml file for more details."/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=""/>
</target>

<!-- =================================================================== -->
<!-- Building
<!-- =================================================================== -->
<target name="prepare">
<mkdir dir="${build.classes}"/>
</target>

<target name="compile" depends="prepare">
<javac destdir="${build.classes}"
optimize="${optimize}"
deprecation="${deprecation}">
<classpath refid="project.class.path" />
<src path="${classes.dir}" />
</javac>
</target>

<target name="dist" depends="compile">
<mkdir dir="${dist.dir}" />
<copy todir="${dist.dir}" >
<fileset dir="${webapps.dir}" />
</copy>
<mkdir dir="${dist.classes}" />
<copy todir="${dist.classes}" >
<fileset dir="${build.classes}" />
</copy>
</target>

<!-- =================================================================== -->
<!-- Cleans everything -->
<!-- =================================================================== -->
<target name="setup-properties" >
<tstamp/>
<property name="dist.dir" value="dist"/>
</target>

<target name="clean" depends="setup-properties">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete verbose="true">
<fileset dir="." includes="**/*~" defaultexcludes="no"/>
<fileset dir="." includes="**/*.bak"/>
</delete>
</target>

</project>
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1