如何将 maven 的 antrun exec 命令的输出重定向到 stdout?



我使用的是Maven 3.0.3。我有这个anrun任务,它使用"exec"命令…

        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <id>start-xvfb</id>
                    <phase>process-test-resources</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <tasks>
                            <echo message="Starting xvfb ..." />
                            <exec executable="Xvfb" spawn="true" failonerror="true">
                                <arg value=":0.0" />
                            </exec>
                        </tasks>
                    </configuration>
                </execution>

虽然我可以在我的输出中看到echo语句,但我不能在标准输出中看到任何可执行文件的输出。我怎么做才能将它重定向到echo消息要去的相同位置?

谢谢,Dave

spawn选项是问题所在。请参阅ant exec任务文档:

如果生成一个命令,它的输出不会被ant记录。

此外,确保没有outputoutput property存在,因为它们会将输出重定向到属性或文件(参见这个stackoverflow问题)。

最新更新