This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 3711d90  THRIFT-4897 generate test resource for thrift-maven-plugin 
Client: Java Patch: James Z.M. Gao <[email protected]>
3711d90 is described below

commit 3711d9081095551c04980d328a2e4729d9730219
Author: James Z.M. Gao <[email protected]>
AuthorDate: Wed Jun 26 09:59:55 2019 +0200

    THRIFT-4897 generate test resource for thrift-maven-plugin
    Client: Java
    Patch: James Z.M. Gao <[email protected]>
    
    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(-)

diff --git a/contrib/thrift-maven-plugin/pom.xml 
b/contrib/thrift-maven-plugin/pom.xml
index b65f6aa..4179b1d 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 c117671..7c90a99 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);

Reply via email to