码迷,mamicode.com
首页 > 其他好文 > 详细

ant 安装

时间:2014-10-16 21:35:43      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:des   blog   http   io   ar   java   sp   文件   div   

1、下载地址:http://ant.apache.org/bindownload.cgi

2、安装:

       1、window以下:

             解压apache-ant-1.8.4-bin.zip 到某个文件夹 F:\tools\apache-ant

            环境变量加入 ANT_HOME    F:\tools\apache-ant

                                      path 追加 F:\tools\apache-ant\bin 

             測试:ant

                        C:\Documents and Settings\zhangchao02>ant
                         Buildfile: build.xml does not exist!
                         Build failed

             測试成功

         2、linux以下:

                解压 cd /usr/local/src   tar -zxvf apache-ant-1.8.4-bin.tar.gz

                环境变量 /etc/profile  加入        export  ANT_HOME=/usr/local/src/apache-ant-1.8.4

                                                                         path 追加 /usr/local/src/apache-ant-1.8.4/bin

                                                                         source /etc/profile

                 測试 ant -version

                 Apache Ant(TM) version 1.8.4 compiled on May 22 2012

  3、ant 具体说明

        1、參考地址:http://www.cnblogs.com/clarkchen/archive/2011/03/10/1980194.html

              http://blog.csdn.net/user4570/article/details/4221101

            http://www.blogjava.net/Files/dreamstone/ant3.rar

        <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="jar" name="TestDemo">
 <target name="A" if="ant.java.version">
  <echo message="Java Version: ${ant.java.version}" />
  <delete dir="build" />
 </target>
 <target name="main" depends="A" unless="amigo">
  <description>
    test depends
     </description>
  <echo message="first ant xml ${basedir}" />
  <mkdir dir="build"/>
  <mkdir dir="build/class"/>
  <javac srcdir="src" destdir="build/class" />
 </target>
 <target name="run" depends="main">
  <java classname="HelloGame">
   <classpath>
    <pathelement path="build/class"/>
   </classpath>
  </java>
 </target>
 <target name="jar" depends="run">
  <jar destfile="helloGame.jar" basedir="build/class">
   <manifest>
    <attribute name="Main-class" value="HelloGame" />
   </manifest>
  </jar>
 </target>
</project>

       

      
                

ant 安装

标签:des   blog   http   io   ar   java   sp   文件   div   

原文地址:http://www.cnblogs.com/gcczhongduan/p/4029498.html

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