#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
猜你喜欢
- 【转载】CentOS安装Tomcat 2023-09-24
- KVM虚拟化Linux Bridge环境部署的方法步骤 2023-07-11
- IIS搭建ftp服务器的详细教程 2022-11-15
- 解决:apache24 安装后闪退和配置端口映射和连接超时设置 2023-09-11
- 教你在docker 中搭建 PHP8 + Apache 环境的过程 2022-10-06
- CentOS_mini下安装docker 之 安装docker CE 2023-09-23
- 阿里云ECS排查CPU数据分析 2022-10-06
- CentOS7安装GlusterFS集群的全过程 2022-10-10
- 利用Docker 运行 python 简单程序 2022-10-16
- nginx中封禁ip和允许内网ip访问的实现示例 2022-09-23