Java Architecture and Management (1)-Apache Ant Short History

Source: Internet
Author: User

#1. Install Apache Ant

 <!--1. Make sure has a Java environment installed, see System Requirements for   details.  2. Download Ant. Http:// .    Uncompress the downloaded file into a directory.  4.      Set Environmental variables Java_home to your JAVA environment, ant_home to the directory of your 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 does this, many of the dependent Ant tasks won't is available. 6 -->


#2. Using Apache Ant

<project name= "MyProject"default= "Dist" basedir= "." > <description>simple Example Build file</description> <!--set global properties for  This Build--<property name= "src" location= "src"/> <property name= "Build" location= "Build"/> <pro        Perty 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} to ${build}-<javac srcdir= "${src}" destdir= "${build}"/&G    T </target> <target name= "Dist" depends= "compile" description= "generate the Distribution" > <!--Cre Ate the distribution directory--<mkdir dir= "${dist}/lib"/> <!--Put everything in ${build} in To the Myproject-${dstamp}.jar file-to-<jar jarfile= "${dist}/lib/myproject-${dstamp}.jar" basedir= "${build}" /> </target> <target name= "clean" description= "clean up" > <!--Delete the ${build} and ${dist} directory tree S-to <delete dir= "${build}"/> <delete dir= "${dist}"/> </target></project>

#3. Running Apache Ant

<!--ant [Options] [Target1 [Target2] [target3]]]options:-help,-H print ThisMessage and Exit-projecthelp,-p Print Project help information and exit-version Print the version information and exit-Diagnostics Print information that might is 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 forJars and Classes-logfile <file>,-l <file> use given file forLog-logger <classname> theclasswhich is to perform logging-listener <classname> Add an instance ofclassAs a project listener-noinput DoNot allow Interactive input-buildfile <file>,     -file <file>,-F <file>Use given build file-d<property>=<value> Use value forgiven property-keep-going,-K execute all targets that DoNot depend on failed target (s)-propertyfile <name> load all properties from file with-D Properties taking precedence-inputhandler <class> Theclasswhich'll handle input requests-find <file>,-S <file> (s) earch forBuildFile towards the root of the filesystem and use it-nice number A niceness value forThe main thread:1 (lowest) to ten (highest); 5 is thedefault-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-->

Java Architecture and Management (1)-Apache Ant Short History

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.