diff options
author | James Z.M. Gao <gaozhiming@360.cn> | 2019-06-26 09:59:55 +0200 |
---|---|---|
committer | Jens Geyer <jensg@apache.org> | 2019-07-01 19:39:52 +0200 |
commit | 3711d9081095551c04980d328a2e4729d9730219 (patch) | |
tree | e63afbc9027209726c1fb53bcef0007ba4b217a5 /contrib | |
parent | a304b7c3a00a3c7a8547d3f66bbe6d128f344415 (diff) | |
download | thrift-3711d9081095551c04980d328a2e4729d9730219.tar.gz |
THRIFT-4897 generate test resource for thrift-maven-plugin
Client: Java
Patch: James Z.M. Gao <gaozhiming@360.cn>
This closes #1822
generate SharedIdl.jar for passing the test case for thrift-maven-plugin
use antrun plugin to generate test jar
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/thrift-maven-plugin/pom.xml | 21 | ||||
-rw-r--r-- | contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestAbstractThriftMojo.java | 4 |
2 files changed, 23 insertions, 2 deletions
diff --git a/contrib/thrift-maven-plugin/pom.xml b/contrib/thrift-maven-plugin/pom.xml index b65f6aa86..4179b1d91 100644 --- a/contrib/thrift-maven-plugin/pom.xml +++ b/contrib/thrift-maven-plugin/pom.xml @@ -33,6 +33,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> <configuration> <source>1.8</source> <target>1.8</target> @@ -48,6 +49,25 @@ </systemPropertyVariables> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.8</version> + <executions> + <execution> + <id>generate-jar-for-test</id> + <phase>generate-test-resources</phase> + <configuration> + <target> + <jar destfile="${project.build.directory}/SharedIdl.jar" basedir="${basedir}/src/test/resources" includes="**/*.thrift" /> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build> <dependencies> @@ -88,5 +108,6 @@ <thrift.root>${basedir}/../..</thrift.root> <thrift.compiler>${thrift.root}/compiler/cpp/thrift</thrift.compiler> <thrift.test.home>${thrift.root}/test</thrift.test.home> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> </project> diff --git a/contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestAbstractThriftMojo.java b/contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestAbstractThriftMojo.java index c1176712d..7c90a990e 100644 --- a/contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestAbstractThriftMojo.java +++ b/contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestAbstractThriftMojo.java @@ -59,7 +59,7 @@ public class TestAbstractThriftMojo { // used by other tests. It's used here to represent a dependency of the project maven is building, // one that is contributing .thrift IDL files as well as any other artifacts. final Iterable<File> classpathElementFiles = Lists.newArrayList( - new File("src/test/resources/dependency-jar-test/SharedIdl.jar") + new File("target/SharedIdl.jar") ); final Set<File> thriftDirectories = mojo.makeThriftPathFromJars(temporaryThriftFileDirectory, classpathElementFiles); @@ -70,7 +70,7 @@ public class TestAbstractThriftMojo { // means it points to the directory containing the "idl" hierarchy rather than to the idl directory // itself. final Set<File> expected = Sets.newHashSet( - new File(testRootDir, "src/test/resources/dependency-jar-test/SharedIdl.jar") + new File(testRootDir, "target/SharedIdl.jar") ); assertEquals("makeThriftPathFromJars should return thrift IDL base path from within JAR", expected, thriftDirectories); |