码迷,mamicode.com
首页 > 编程语言 > 详细

java构建与管理(1) - Apache Ant Short History

时间:2015-09-23 15:08:14      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:

#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 for this 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
-->

 

java构建与管理(1) - Apache Ant Short History

标签:

原文地址:http://www.cnblogs.com/thlzhf/p/4832123.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!