ant 常用命令
来源:互联网 发布:java最新开发面试题 编辑:程序博客网 时间:2024/05/29 17:54
首先安装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 "等
假定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 "等
- ant 常用命令
- ant 常用命令
- ant常用命令
- Ant常用命令
- ANT 常用命令
- ant部分常用命令
- Ant常用命令详解
- Ant入门教程之常用命令
- Mvn常用命令以及Ant常用命令比较
- Apache Ant自动化脚本入门教程及常用命令介绍
- ant
- ant
- Ant
- ant
- ANT
- ANT
- ant
- ant
- squid 时间控制周一到周日的写法
- http://projecteuler.net/problem=19 [Answer:171]
- jsp 与servlet 过滤器
- 用 jconsole 监控 WebSphere AppServer JVM使用情况
- http://projecteuler.net/problem=20 [Answer:648]
- ant 常用命令
- 服务器实时同步文件 服务镜像解决方案 lsyncd
- 怎样做好一个团队领导 情商与智商共存
- 奔着各个银行北分去的研究生们,友情提示一下你们
- http://projecteuler.net/problem=21 [Answer:31626]
- 看门狗
- [USACO 1.2.5] Dual Palindromes
- 四十一秒浓缩一生。
- c/s模式在移动便携系统应用的一点理解