Ant 常用Task
来源:互联网 发布:台达esplc编程软件 编辑:程序博客网 时间:2024/05/01 12:33
Installation:
1. Set the ANT_HOME environment variable to point to this location.
2. Set the JAVA_HOME environment variable to point to the JDK location.
3. Add ANT_HOME/bin to your system's PATH environment variable.
Build file :
1. ${build.dir} means referenced a var :build.dir
2. specify diretory :
<property name="src.dir" value="src"/>
<!-- Temporary build directories -->
<property name="build.dir" value="build"/>
3. make dir on specified diretory :
<target name="prepare">
<mkdir dir="${build.lib}"/>
</target>
4. clean dir
<target name="clean" description="Remove all generated files.">
<delete dir="${build.dir}"/>
</target>
5. compile java files
<target name="compile" depends="prepare"
description="Compiles all source code.">
<javac srcdir="${src.dir}"
destdir="${build.classes}"/>
</target>
6. jar java files
<target name="jar" depends="compile"
description="Generates oreilly.jar in the 'dist' directory.">
<!-- Exclude unit tests from the final JAR file -->
<jar jarfile="${build.lib}/oreilly.jar"
basedir="${build.classes}"
excludes="**/*Test.class"/>
</target>
7. target can be invoked single : eg.
command line : ant jar
8. specify classpath and compile :
<path id="mypath">
<pathelement location="${java.home}/jre/lib/rt.jar"/>
</path>
<target name="all">
<javac srcdir=".">
<classpath refid="mypath"/>
</javac>
</target>
or
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
9. copy files
<copy todir="${weblogic.dir}/${weblogic.server.home}/public_html/jsp">
<fileset dir="${src.www.dir}/jsp"/>
</copy>
10.Javadoc
<target name = “javadoc” depends=”compile,jar”>
<mkdir dir = “${doc.dir}/api”/>
<javadoc packagenames = “ myproj.*”
sourchpath = “${src.dir}”
destdir = “${doc.dir}/api”
author = “true”
version = “true”
use = “true”>
<classpath refid = “classpath”/>
</javadoc>
</target>
all in a build.xml file:
<?xml version="1.0"?>
<!-- build.xml - a simple Ant buildfile -->
<project name="Simple Buildfile" default="compile" basedir=".">
<!-- The directory containing source code -->
<property name="src.dir" value="src"/>
<!-- Temporary build directories -->
<property name="build.dir" value="build"/>
<property name="build.classes" value="${build.dir}/classes"/>
<property name="build.lib" value="${build.dir}/lib"/>
<!-- Target to create the build directories prior to the -->
<!-- compile target. -->
<target name="prepare">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.lib}"/>
</target>
<target name="clean" description="Remove all generated files.">
<delete dir="${build.dir}"/>
</target>
<target name="compile" depends="prepare"
description="Compiles all source code.">
<javac srcdir="${src.dir}" destdir="${build.classes}"/>
</target>
<target name="jar" depends="compile"
description="Generates oreilly.jar in the 'dist' directory.">
<!-- Exclude unit tests from the final JAR file -->
<jar jarfile="${build.lib}/oreilly.jar"
basedir="${build.classes}"
excludes="**/*Test.class"/>
</target>
<target name="all" depends="clean,jar"
description="Cleans, compiles, then builds the JAR file."/>
</project>
- Ant 常用Task
- ant常用task
- ant常用task之condition
- ANT SVN TASK
- ant war task 例子
- 自定义Ant Task
- Ant高级-task
- Ant Task Note
- Maven-Ant-Task 使用手记
- [Ant] Echo task
- TestNG 与 Ant Task
- Ant高级-task
- ant学习笔记-task
- Ant之Task
- maven ant task
- ant 标签名 自定义Task
- jbpm ant start.human.task
- Ant的任务(task)
- 刚刚开通,just a test
- 四僧记(序) / 张豫
- 连接ORACLE数据库
- 四僧记(一) / 张豫
- int main(int argc,char **argv)
- Ant 常用Task
- 《C#数据库入门经典笔记》
- [原创]dataGrid在页面拖动行(在表头,用htc文件实现)
- 不开心!
- Win32 API 实现系统托盘程序
- 哈哈,终于找回来了《手放开》
- Problem 108 Your Ride Is Here
- ASP.NET学习笔记
- IE与Mozilla下Dhtml的一些区别小结