Dave
Dave

Reputation: 19280

How do I redirect maven's antrun exec command's output to stdout?

I'm using Maven 3.0.3. I have this antrun task, which uses the "exec" command ...

<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>

Although I can see the echo statement in my output, I can't see any of the executables output in standard out. What can I do to redirect it to the same place that the echo message goes to?

Upvotes: 6

Views: 4566

Answers (1)

Alexander Klimetschek
Alexander Klimetschek

Reputation: 3724

The spawn option is the problem. See the ant exec task documentation:

If you spawn a command, its output will not be logged by ant.

Furthermore, make sure there is no output or output property present, as they will redirect the output to a property or file (see this stackoverflow question).

Upvotes: 7

Related Questions