我正在尝试从 Ant 构建文件中运行以下命令:
sh /home/myuser/scripts/run.sh -p=8888 -z=true /home/myuser/resources/mydir
到目前为止,这是我最好的尝试:
<target name="run">
<exec executable="/bin/bash">
<arg line="/home/myuser/scripts/run.sh"/>
<arg line="-p=8888"/>
<arg line="-z=true"/>
<arg line="/home/myuser/resources/mydir"/>
</exec>
</target>
BUILD SUCCESSFUL
当我运行它时,除了一条消息之外,我没有得到任何 Ant 输出。但是,从终端运行此脚本会产生大量输出。我不确定我<exec/>
是否正确设置了任务,或者如何开始调试它。提前致谢。
当我以详细模式运行 ant 时更新,我得到以下输出:
[exec] Current OS is Linux
[exec] Executing '/bin/bash' with arguments:
[exec] '/home/myuser/scripts/run.sh'
[exec] '-p=8888'
[exec] '-z=true'
[exec] '/home/myuser/resources/mydir'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
[exec] Usage: <run> [options] <your dir>
所以看起来 Ant 正在我的参数周围插入单引号。有什么办法可以禁用这种行为?