zoukankan      html  css  js  c++  java
  • ant 常用命令

     首先安装ANT
    假定Ant安装在c:\ant\目录下。下面是设定环境的命令:
    set   ANT_HOME=c:\ant
    set   JAVA_HOME=c:\j2sdk1.4.1
    set   PATH=%PATH%;%ANT_HOME%\bin

    运行Ant非常简单,当你正确地安装Ant后,只要输入ant就可以了。

    没有指定任何参数时,Ant会在当前目录下查询build.xml文件。如果找到了就用该文件作为buildfile。如果你用-find   选项。Ant就会在上级目录中寻找buildfile,直至到达文件系统的根。要想让Ant使用其他的buildfile,可以用参数-buildfile   file,这里file指定了你想使用的buildfile的文件名。

    你也可以设定一些属性,以覆盖buildfile中指定的属性值(参看property   task)。可以用   -Dproperty=value   选项,这里property是指属性的名称,而value则是指属性的值。也可以用这种办法来指定一些环境变量的值。你也可以用property   task来存取环境变量。只要将   -DMYVAR=%MYVAR%   (Windows)   或   -DMYVAR=$MYVAR   (Unix)   传递给Ant   -你就可以在你的buildfile中用${MYVAR}来存取这些环境变量。

    还有两个选项-quite,告诉Ant运行时只输出少量的必要信息,如:BUILD   SUCCESSFUL。而-verbose,告诉Ant运行时要输出更详细的信息。

    可以指定执行一个或多个target。当省略target时,Ant使用标签 <project> 的default属性所指定的target。
    -projecthelp选项输出项目的描述信息和项目target的列表。先列出那些有描述的,然后是没有描述的target。

    命令行选项总结:

    ant   [options]   [target   [target2   [target3]   ...]]

    Options:
    -help   print   this   message
    -projecthelp   print   project   help   information
    -version   print   the   version   information   and   exit
    -quiet   be   extra   quiet
    -verbose   be   extra   verbose
    -debug   print   debugging   information
    -emacs   produce   logging   information   without   adornments
    -logfile   <file>         use   given   file   for   log   output
    -logger   <classname>       the   class   which   is   to   perform   logging
    -listener   <classname>     add   an   instance   of   class   as   a   project   listener
    -buildfile   <file>   use   specified   buildfile
    -find   <file>   search   for   buildfile   towards   the   root   of   the   filesystem   and   use   the   first   one   found
    -D <property> = <value> set   property   to   value  

    例子

    ant
    使用当前目录下的build.xml运行Ant,执行缺省的target。

    ant   -buildfile   test.xml
    使用当前目录下的test.xml运行Ant,执行缺省的target。

    ant   -buildfile   test.xml   dist
    使用当前目录下的test.xml运行Ant,执行一个叫做dist的target。

    ant   -buildfile   test.xml   -Dbuild=build/classes   dist
    使用当前目录下的test.xml运行Ant,执行一个叫做dist的target,并设定build属性的值为build/classes。

    Ant的buildfile是用XML写的。每个buildfile都含有一个project。
    常用的元素有 "project "、 "target "、 "path "、 "property "等。  
    常用的任务有 "ant "、 "mkdir "、 "delete "、 "copy "、 "javac "、 "jar "、 "javadoc "、 "echo "等

  • 相关阅读:
    Linux中使用 FTP 命令时出现 “-bash: ftp: command not found”
    Jenkins Build step 'Execute shell' marked build as failure
    centos7ping www.baidu.com没有ping通
    linux maven 安装
    位运算初步
    C++ STL:next_permutation和prev_permutation
    逆波兰表达式
    STL与基本数据结构
    学习记录:指针(未整理)
    Codeforces Round #615 (Div. 3) 补题记录
  • 原文地址:https://www.cnblogs.com/mengjianzhou/p/5986889.html
Copyright © 2011-2022 走看看