[英]Apache Ant property value with interperter
Why can't I set property like this in Apache Ant? 为什么我不能在Apache Ant中设置这样的属性?
<property name="checker" value="php ${basedir}/vendor/code-checker/src/cc.php" />
And then exec it like this 然后像这样执行
<exec executable="${checker}">
<arg value="-d" />
<arg path="${basedir}/src" />
</exec>
Instead I have to specify whole path with that scripts' interpreter each time I want to use that checker 相反,每次我要使用该检查器时,都必须使用该脚本的解释器指定整个路径
<exec executable="php">
<arg value="vendor/code-checker/src/cc.php" />
<arg value="-d" />
<arg path="${basedir}/src" />
</exec>
You can either use executable
for the executable you want to run ( php
in this case) and arg
for its arguments, or you can specify the command and all its arguments in a single space-separated attribute 您可以使用
executable
你要运行(可执行php
在这种情况下)和arg
为它的参数, 或者你可以在一个单一的空格分隔的属性指定命令及其所有参数
<exec command="${checker} -d ${basedir}/src"/>
You can't mix and match the two. 您不能将两者混在一起。 And note that the
command
form will not work if the basedir
contains spaces. 并请注意,如果
basedir
包含空格,则command
格式将不起作用。 If there's any chance of an individual argument containing spaces then there's no choice, you must use the executable
and arg
form. 如果单个参数有可能包含空格,则别无选择, 必须使用
executable
和arg
形式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.