Ant command line arguments

本文详细介绍了Apache Ant中用于指定命令行参数的各种元素,包括如何处理包含空格的参数及路径转换等内容,并提供了多个示例。同时,还总结了Ant命令行选项,帮助读者更好地理解和使用Ant。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转自: http://www.allapplabs.com/ant/ant_command_line.htm


Several tasks take arguments that will be passed to another process on the command line. To make it easier to specify arguments that contain space characters, nested arg elements can be used.

value - a single command-line argument; can contain space characters.
file - The name of a file as a single command-line argument; will be replaced with the absolute filename of the file.
path - A string that will be treated as a path-like string as a single command-line argument; you can use ; or : as path separators and Ant will convert it to the platform's local conventions.
pathref - Reference to a path defined elsewhere. Ant will convert it to the platform's local conventions.
line a space-delimited list of command-line arguments.


It is highly recommended to avoid the line version when possible. Ant will try to split the command line in a way similar to what a (Unix) shell would do, but may create something that is very different from what you expect under some circumstances. 

Examples
<arg value="-l -a"/>
is a single command-line argument containing a space character.
<arg line="-l -a"/>
represents two separate command-line arguments.
<arg path="/dir;/dir2:\dir3"/>
is a single command-line argument with the value \dir;\dir2;\dir3 on DOS-based systems and /dir:/dir2:/dir3 on Unix-like systems.
 

Command-line Options Summary
ant [options] [target [target2 [target3] ...]]
 

Options:

-help, -hDisplays help information describing the Ant command and its options
-projecthelp, -pPrint project help information
-versionPrint the version information and exit
-diagnosticsPrint information that might be helpful to diagnose or report problems.
-quiet, -qSuppresses most messages not originated by an echo task in the buildfile
-verbose, -vDisplays detailed messages for every operation during a build.
-debug, -dPrint debugging information
-emacs, -eProduce logging information without adornments
-lib <path>Specifies a path to search for jars and classes
-logfile <file>Use given file for log
-l <file>Use given file for log
-logger <classname>Specifies a class to handle Ant logging.
-listener <classname>Add an instance of class as a project listener
-noinputDo not allow interactive input
-buildfile <file>Use given buildfile
-file <file>Use given buildfile
-f <file>Use given buildfile
-D<property>=<value>Defines a property name-value pair on the command line.
-keep-going, -kexecute 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>Search for buildfile towards the root of the filesystem and use it


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值