gpt4 book ai didi

ant - 在任务名称中使用连字符运行 Ant 任务的命令行

转载 作者:行者123 更新时间:2023-12-03 11:13:57 24 4
gpt4 key购买 nike

任务名称以连字符“-”开头。

<?xml version="1.0" encoding="UTF-8"?>
<project name="proj">
<target name="-task1">
<echo>Done!</echo>
</target>
</project>

从命令行运行 ant 脚本时如何指定此任务?这行不通:
ant -task1 -f test.xml

最佳答案

用引号将任务名称括起来。

ant "-task1" -f test.xml

更新:
来自 Ant docs
Targets beginning with a hyphen such as "-restart" are valid,
and can be used to name targets that should not be called directly
from the command line.
For Ants main class every option starting with hyphen is an option for Ant itself
and not a target. For that reason calling these target from command line is not
possible. On the other hand IDEs usually don't use Ants main class as entry
point and calling them from the IDE is usually possible.

关于ant - 在任务名称中使用连字符运行 Ant 任务的命令行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4256958/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com