question about suing jarjar maven plugin to resolve dependencies conflict

39 views
Skip to first unread message

Zhang Xiaoyu

unread,
Oct 10, 2013, 7:11:34 PM10/10/13
to jar...@googlegroups.com
Hi, all,
my project has two component, class A needs thrift 0.9, and class B needs thrift 0.7. A and B are in one project and share one top level pom file. B pull the thrift 0.7 as a transitive dependency , so I need to pull thrift 0.9 for A explicitly.

I am doing below to re-package thrift 0.9 for A, so other classes will not get it.

I don't quite understand what is tag <keep> for ?

My understand is use <include> to grab the maven dependencies I want to re-package, then use <pattern> and <result> in <rule> to define what class to re-package and what's the new name for re-packaged binary.
And use <keep> to indicate which class in the project will only use this re-packaged dependencies, in my case, it is project A. Am I right ?

below pom doesn't work for me, and class A, B still share the same thrift 0.9. Thrift 0.7 is omitted.

Thanks a lot for help,
Johnny

<dependency>

<groupId>org.apache.thrift</groupId>

<artifactId>libthrift</artifactId>

<version>0.9.0</version>

</dependency>

......

......

<plugin>

<groupId>org.sonatype.plugins</groupId>

      <artifactId>jarjar-maven-plugin</artifactId>

      <executions>

           <execution>

             <phase>package</phase>

             <goals>

               <goal>jarjar</goal>

             </goals>

             <configuration>

               <includes>

                 <include>org.apache.thrift:libthrift</include>

               </includes>

               <rules>

                 <rule>

                   <pattern>org.apache.thrift.**</pattern>

                   <result>com.google.inject.internal.internal.thrift.@1</result>

                 </rule>

                 <keep>

                   <pattern>com.class.A.pattern.**</pattern>

                  </keep>

               </rules>

             </configuration>

           </execution>

        </executions>

</plugin>

Reply all
Reply to author
Forward
0 new messages