Allow killing test server/client

mvn exec:exec doesn't kill the child process when Maven is killed. Now
we just run ourselves, but have Maven do as much heavy lifting as able.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81736090
This commit is contained in:
ejona 2014-12-09 18:03:24 -08:00 committed by Eric Anderson
parent fc30031fd1
commit 42989a83ff
4 changed files with 62 additions and 17 deletions

View File

@ -88,21 +88,52 @@
</executions>
</plugin>
<!-- run-test-xxx.sh invoke this plugin to launch a test client/server. -->
<plugin>
<groupId>kr.motd.maven</groupId>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>${java.home}/bin/java</executable>
<commandlineArgs>
${argLine.bootcp}
-classpath
%classpath
${exampleClass}
${argLine.example}
</commandlineArgs>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>com.internetitem</groupId>
<artifactId>write-properties-file-maven-plugin</artifactId>
<executions>
<execution>
<id>bootclasspath</id>
<phase>prepare-package</phase>
<goals>
<goal>write-properties-file</goal>
</goals>
<configuration>
<filename>bootclasspath.properties</filename>
<outputDirectory>${project.build.directory}</outputDirectory>
<properties>
<property>
<name>bootclasspath</name>
<value>${argLine.bootcp}</value>
</property>
<property>
<name>jar</name>
<value>${project.build.directory}/${project.artifactId}-${project.version}-jar-with-dependencies.jar</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
</project>

12
pom.xml
View File

@ -290,6 +290,16 @@
<artifactId>maven-protoc-plugin</artifactId>
<version>0.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>com.internetitem</groupId>
<artifactId>write-properties-file-maven-plugin</artifactId>
<version>1.0.1</version>
</plugin>
</plugins>
</pluginManagement>
@ -362,4 +372,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View File

@ -3,6 +3,8 @@ TARGET='Test Service Client'
TARGET_CLASS='com.google.net.stubby.testing.integration.TestServiceClient'
TARGET_ARGS="$@"
cd "`dirname "$0"`"/integration-testing
cd "$(dirname "$0")"
mvn -q -nsu -pl integration-testing -am package -Dcheckstyle.skip=true -DskipTests
. integration-testing/target/bootclasspath.properties
echo "[INFO] Running: $TARGET ($TARGET_CLASS $TARGET_ARGS)"
exec mvn -q -nsu compile exec:exec -Dcheckstyle.skip=true -DexampleClass="$TARGET_CLASS" -DargLine.example="$TARGET_ARGS"
exec java "$bootclasspath" -cp "$jar" "$TARGET_CLASS" $TARGET_ARGS

View File

@ -3,6 +3,8 @@ TARGET='Test Service Server'
TARGET_CLASS='com.google.net.stubby.testing.integration.TestServiceServer'
TARGET_ARGS="$@"
cd "`dirname "$0"`"/integration-testing
cd "$(dirname "$0")"
mvn -q -nsu -pl integration-testing -am package -Dcheckstyle.skip=true -DskipTests
. integration-testing/target/bootclasspath.properties
echo "[INFO] Running: $TARGET ($TARGET_CLASS $TARGET_ARGS)"
exec mvn -q -nsu compile exec:exec -Dcheckstyle.skip=true -DexampleClass="$TARGET_CLASS" -DargLine.example="$TARGET_ARGS"
exec java "$bootclasspath" -cp "$jar" "$TARGET_CLASS" $TARGET_ARGS