【问题标题】:How do I redirect maven's antrun exec command's output to stdout?如何将 maven antrun exec 命令输出重定向到标准输出?
【发布时间】:2011-12-06 17:16:25
【问题描述】:

我正在使用 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 语句,但在标准输出中看不到任何可执行文件输出。我该怎么做才能将它重定向到回显消息所在的同一位置?

谢谢,- 戴夫

【问题讨论】:

  • 对于遇到此问题的任何人,在 maven-antrun-plugin:3.x 中,task 将替换为 execution

标签: maven maven-antrun-plugin


【解决方案1】:

spawn 选项是问题所在。见ant exec task documentation

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

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

【讨论】:

    猜你喜欢
    • 2017-03-31
    • 1970-01-01
    • 2011-12-15
    • 1970-01-01
    • 2019-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多