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

时间:2011-12-06 17:16:26

标签: maven maven-antrun-plugin

我正在使用Maven 3.0.3。我有这个antrun任务,它使用“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消息所在的相同位置?

谢谢, - 戴夫

1 个答案:

答案 0 :(得分:8)

spawn 选项是问题所在。请参阅ant exec task documentation

  

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

此外,请确保没有outputoutput property,因为他们会将输出重定向到属性或文件(请参阅this stackoverflow question)。