#1. Install Apache Ant!--1. Make sure you have a Java environment installed, See System Requirements for details.2. Download Ant. http://ant.apache.org/3. Uncompress the downloaded file into a direct...
#1. Install Apache Ant
<!--
1. Make sure you have a Java environment installed, See System Requirements for details.
2. Download Ant. http://ant.apache.org/
3. Uncompress the downloaded file into a directory.
4. Set environmental variables JAVA_HOME to your Java environment, ANT_HOME to the directory you uncompressed Ant to,
and add ${ANT_HOME}/bin (Unix) or %ANT_HOME%/bin (Windows) to your PATH.
5. Optionally, from the ANT_HOME directory run ant -f fetch.xml -Ddest=system to get the library dependencies of most of
the Ant tasks that require them. If you don‘t do this, many of the dependent Ant tasks will not be available.
6. Optionally, add any desired Antlibs.
-->
#2. Using Apache Ant
<project name="MyProject" default="dist" basedir="."> <description>simple example build file</description> <!-- set global properties forthis build --> <property name="src" location="src"/> <property name="build" location="build"/> <property name="dist" location="dist"/> <target name="init"> <!-- Create the time stamp --> <tstamp/> <!-- Create the build directory structure used by compile --> <mkdir dir="${build}"/> </target> <target name="compile" depends="init" description="compile the source"> <!-- Compile the java code from ${src} into ${build} --> <javac srcdir="${src}" destdir="${build}"/> </target> <target name="dist" depends="compile" description="generate the distribution"> <!-- Create the distribution directory --> <mkdir dir="${dist}/lib"/> <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --> <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/> </target> <target name="clean" description="clean up"> <!-- Delete the ${build} and ${dist} directory trees --> <delete dir="${build}"/> <delete dir="${dist}"/> </target> </project>
#3. Running Apache Ant
<!-- ant [options] [target1 [target2 [target3]]] Options: -help, -h print this message and exit -projecthelp, -p print project help information and exit -version print the version information and exit -diagnostics print information that might be helpful to diagnose or report problems and exit -quiet, -q be extra quiet -silent, -S print nothing but task outputs and build failure -verbose, -v be extra verbose -debug, -d print debugging information -emacs, -e produce logging information without adornments -lib <path> specifies a path to search for jars and classes -logfile <file>, -l <file> use given file for log -logger <classname> the class which is to perform logging -listener <classname> add an instance of class as a project listener -noinput do not allow interactive input -buildfile <file>, -file <file>, -f <file> use given build file -D<property>=<value> use value for given property -keep-going, -k execute all targets that do not depend on failed target(s) -propertyfile <name> load all properties from file with -D properties taking precedence -inputhandler <class> the class which will handle input requests -find <file>, -s <file> (s)earch for buildfile towards the root of the filesystem and use it -nice number A niceness value for the main thread: 1 (lowest) to 10 (highest); 5 is the default -nouserlib Run ant without using the jar files from ${user.home}/.ant/lib -noclasspath Run ant without using CLASSPATH -autoproxy Java 1.5+ : use the OS proxies -main <class> override Ant‘s normal entry point -->
原文:http://www.cnblogs.com/thlzhf/p/4832123.html
沃梦达教程
本文标题为:java构建与管理(1) - Apache Ant Short History
基础教程推荐
猜你喜欢
- 服务器添加git钩子的步骤 2022-12-12
- linux下安装apache与php;Apache+PHP+MySQL配置攻略 2023-08-07
- Apache Hudi数据布局黑科技降低一半查询时间 2022-10-06
- linux之conda环境安装全过程 2023-07-11
- 实战Nginx_取代Apache的高性能Web服务器 2023-09-29
- Apache服务器配置攻略3 2022-09-01
- apache和nginx结合使用 2023-09-10
- centos 7 安装及配置zabbix agent 2023-09-24
- nginx.conf(centos7 1.14)主配置文件修改 2023-09-23
- IIS 6 的 PHP 最佳配置方法 2022-09-01