Use a forked exec-maven-plugin instead of maven-antrun-plugin

Motivation:

maven-antrun-plugin does not redirect stdin, and thus it's impossible to
run interactive examples such as securechat-client and telnet-client.
org.codehaus.mojo:exec-maven-plugin redirects stdin, but it buffers
stdout and stderr, and thus an application output is not flushed timely.

Modifications:

Deploy a forked version of exec-maven-plugin which flushes output
buffers in a timely manner.

Result:

Interactive examples work.  Launches faster than maven-antrun-plugin.
This commit is contained in:
Trustin Lee 2014-05-23 20:09:15 +09:00
parent 4ce1274497
commit 9ab8898db1
3 changed files with 17 additions and 18 deletions

24
pom.xml
View File

@ -502,12 +502,6 @@
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<configuration>
<target>
<property name="runtime_classpath" refid="maven.runtime.classpath"/>
<ant antfile="${antfile}"/>
</target>
</configuration>
<executions>
<execution>
<id>write-version</id>
@ -515,7 +509,7 @@
<goals>
<goal>run</goal>
</goals>
<configuration combine.self="override">
<configuration>
<target>
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<exec executable="git" outputproperty="gitOutput" resultproperty="gitExitCode" failonerror="false" failifexecutionfails="false">
@ -545,7 +539,7 @@
<goals>
<goal>run</goal>
</goals>
<configuration combine.self="override">
<configuration>
<target>
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<if>
@ -736,6 +730,20 @@
</dependency>
</dependencies>
</plugin>
<!-- run-example.sh invokes this plugin to launch an example. -->
<plugin>
<groupId>kr.motd.maven</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.0.0.Final</version>
<configuration>
<executable>${java.home}/bin/java</executable>
<commandlineArgs>
-classpath %classpath
${argLine.example}
${exampleClass}
</commandlineArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -83,5 +83,5 @@ fi
cd "`dirname "$0"`"
echo "[INFO] Running: $EXAMPLE ($EXAMPLE_CLASS $EXAMPLE_ARGS)"
exec mvn -nsu compile antrun:run -Dcheckstyle.skip=true -Dantfile=src/antrun/run-example.xml -DargLine.example="$EXAMPLE_ARGS" -DexampleClass="$EXAMPLE_CLASS"
exec mvn -q -nsu compile exec:exec -Dcheckstyle.skip=true -DargLine.example="$EXAMPLE_ARGS" -DexampleClass="$EXAMPLE_CLASS"

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="run-example">
<target name="run-example">
<java classname="${exampleClass}" classpath="${runtime_classpath}" fork="true">
<jvmarg line="${argLine.example}" />
</java>
</target>
</project>