如何将 ant exec 任务输出重定向到文件和标准输出?
问题描述:
我正在使用 ant (1.8.2) exec 任务 来启动子进程.我需要将子进程的输出显示为正常 ant 控制台输出的一部分,但也要在文件中捕获.
I am using the ant (1.8.2) exec task to start a child process. I need the output of the child process to be shown as part of the normal ant console output, but also be captured in a file.
答
您需要 重定向器
从 Ant 1.6.3 开始,它有一个名为 alwayslog
的选项.
Since Ant 1.6.3 it has an option called alwayslog
.
像这样使用它:
<exec executable="mycommand">
<redirector output="myfile.txt" alwayslog="true"/>
</exec>