是否可以使用包含可执行文件的工作目录以外的工作目录从 ant 运行可执行文件?这个小蚂蚁项目展示了我想要实现的目标。
文件夹结构
ant test
| build.xml
| bin
| | debug
| | | program.exe
| | release
| | | program.exe
| | inputs
| | | ...
| | outputs
| | | ...
Run Code Online (Sandbox Code Playgroud)
构建文件
<project name="test" basedir="./">
<target name="run">
<exec executable="${configuration}\program.exe" dir="bin"/>
</target>
</project>
Run Code Online (Sandbox Code Playgroud)
${configuration}设置为release。
bin需要在工作目录,以便在可执行文件的参考文件inputs和outputs正确的,所以我希望能够运行包含在可执行文件bin/release从bin目录。但是,ant 找不到可执行文件:
BUILD FAILED
D:\ant test\build.xml:6: Execute failed: java.io.IOException: Cannot run program "release\program.exe" (in directory "D:\ant test\bin"): CreateProcess …Run Code Online (Sandbox Code Playgroud) ant ×1