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
223efc5f99
commit
9961cae7cf
@ -293,7 +293,7 @@
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration combine.self="override">
|
||||
<configuration>
|
||||
<target>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
||||
<propertyselector property="versions" match="^(${project.groupId}:(?!netty-example)[^:]+:jar)$" select="\1" />
|
||||
|
@ -103,18 +103,21 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- run-example.sh invokes this plugin to launch an example. -->
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<groupId>kr.motd.maven</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<target>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
||||
<propertyregex
|
||||
property="mergedArgs" regexp="[\r\n\s]+" replace=" " global="true"
|
||||
input="${argLine.common} ${argLine.bootcp} ${argLine.leak} ${argLine.coverage} ${argLine.example}" />
|
||||
<java classname="${exampleClass}" classpathref="maven.runtime.classpath" fork="true">
|
||||
<jvmarg line="${mergedArgs}"/>
|
||||
</java>
|
||||
</target>
|
||||
<executable>${java.home}/bin/java</executable>
|
||||
<commandlineArgs>
|
||||
${argLine.common}
|
||||
${argLine.bootcp}
|
||||
-classpath %classpath
|
||||
${argLine.leak}
|
||||
${argLine.coverage}
|
||||
${argLine.example}
|
||||
${exampleClass}
|
||||
</commandlineArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
7
pom.xml
7
pom.xml
@ -857,7 +857,7 @@
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration combine.self="override">
|
||||
<configuration>
|
||||
<target>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
||||
|
||||
@ -1070,6 +1070,11 @@
|
||||
<artifactId>maven-hawtjni-plugin</artifactId>
|
||||
<version>1.10</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>kr.motd.maven</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.0.0.Final</version>
|
||||
</plugin>
|
||||
|
||||
<!-- Workaround for the 'M2E plugin execution not covered' problem.
|
||||
See: http://wiki.eclipse.org/M2E_plugin_execution_not_covered -->
|
||||
|
@ -91,5 +91,5 @@ fi
|
||||
|
||||
cd "`dirname "$0"`"/example
|
||||
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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user