From 3711d9081095551c04980d328a2e4729d9730219 Mon Sep 17 00:00:00 2001 From: "James Z.M. Gao" Date: Wed, 26 Jun 2019 09:59:55 +0200 Subject: THRIFT-4897 generate test resource for thrift-maven-plugin Client: Java Patch: James Z.M. Gao This closes #1822 generate SharedIdl.jar for passing the test case for thrift-maven-plugin use antrun plugin to generate test jar --- contrib/thrift-maven-plugin/pom.xml | 21 +++++++++++++++++++++ .../apache/thrift/maven/TestAbstractThriftMojo.java | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'contrib') 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 @@ org.apache.maven.plugins maven-compiler-plugin + 3.8.1 1.8 1.8 @@ -48,6 +49,25 @@ + + org.apache.maven.plugins + maven-antrun-plugin + 1.8 + + + generate-jar-for-test + generate-test-resources + + + + + + + run + + + + @@ -88,5 +108,6 @@ ${basedir}/../.. ${thrift.root}/compiler/cpp/thrift ${thrift.root}/test + UTF-8 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 classpathElementFiles = Lists.newArrayList( - new File("src/test/resources/dependency-jar-test/SharedIdl.jar") + new File("target/SharedIdl.jar") ); final Set 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 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); -- cgit v1.2.1