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:
parent
4ce1274497
commit
9ab8898db1
24
pom.xml
24
pom.xml
@ -502,12 +502,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-antrun-plugin</artifactId>
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
<version>1.7</version>
|
<version>1.7</version>
|
||||||
<configuration>
|
|
||||||
<target>
|
|
||||||
<property name="runtime_classpath" refid="maven.runtime.classpath"/>
|
|
||||||
<ant antfile="${antfile}"/>
|
|
||||||
</target>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>write-version</id>
|
<id>write-version</id>
|
||||||
@ -515,7 +509,7 @@
|
|||||||
<goals>
|
<goals>
|
||||||
<goal>run</goal>
|
<goal>run</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration combine.self="override">
|
<configuration>
|
||||||
<target>
|
<target>
|
||||||
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
||||||
<exec executable="git" outputproperty="gitOutput" resultproperty="gitExitCode" failonerror="false" failifexecutionfails="false">
|
<exec executable="git" outputproperty="gitOutput" resultproperty="gitExitCode" failonerror="false" failifexecutionfails="false">
|
||||||
@ -545,7 +539,7 @@
|
|||||||
<goals>
|
<goals>
|
||||||
<goal>run</goal>
|
<goal>run</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration combine.self="override">
|
<configuration>
|
||||||
<target>
|
<target>
|
||||||
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
||||||
<if>
|
<if>
|
||||||
@ -736,6 +730,20 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</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>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
@ -83,5 +83,5 @@ fi
|
|||||||
|
|
||||||
cd "`dirname "$0"`"
|
cd "`dirname "$0"`"
|
||||||
echo "[INFO] Running: $EXAMPLE ($EXAMPLE_CLASS $EXAMPLE_ARGS)"
|
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"
|
||||||
|
|
||||||
|
@ -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>
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user