Question

I'm using maven-ant-run plugin to run jar batch through maven, it works cool, what I need is to be able to read system.out.println strings in maven build report.

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.6</version>
                <executions>
                    <execution>
                        <phase>clean</phase>
                        <configuration>
                            <target>
                                <echo>
                                    Language synchronization is being started
                                </echo>
                                <exec executable="cmd.exe"
                                      spawn="true">
                                    <arg value="/c"/>
                                    <arg value="${languagesynch.path}"/>
                                    <arg value="C:\ContinuousIntegration\res" /> <!--copy from-->
                                    <arg value="${project.basedir}\res" /> <!--to this directory-->


                                </exec>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

it only shows executing tasks and executed tasks.

[INFO] --- maven-antrun-plugin:1.6:run (default) ---
[INFO] Executing tasks

main:
     [echo] Language synchronization is being started through D:\Projects\MavenI
nHerd\LanguageSynch\out\artifacts\LanguageSynch_jar\LanguageSynch.jar
[INFO] Executed tasks
Was it helpful?

Solution

If you use spawn="true", this is not possible. Set spawn to false (default), and it works.

Update:

Try using:

<java fork="true" 
      jar="${languagesynch.path}/dist/test.jar">
    <arg value="C:\ContinuousIntegration\res" /> <!--copy from-->
    <arg value="${project.basedir}\res" /> <!--to this directory-->
</java>

Or if for any reason you MUST use exec:

<exec executable="cmd.exe" spawn="false">
    <arg value="/c"/>
    <arg value="java"/>
    <arg value="-jar"/>
    <arg value="${languagesynch.path}"/>
    <arg value="C:\ContinuousIntegration\res" /> <!--copy from-->
    <arg value="${project.basedir}\res" /> <!--to this directory-->
</exec>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top