pom.xml - maven copy-dependencies includeGroupIds and all transitive elements to those -


i try figure out how can copy dependencies explicite version , required dependencies.

for example: project requieres version 3 of third party lib, called foobar. want copy version 3 libraries folder named lib-foobar-${foobar.version}. in folder jars required use foobar in version 3. means jar , dependent jars declared in foobar pom.

i use org.codehaus.mojo:maven-dependency-plugin:2.1 goal copy-dependencies in phase package. configuration is

<configuration>     <outputdirectory>${project.build.directory}/lib-foobar-${foobar.version}</outputdirectory>     <includegroupids>com.foobar</includegroupids>     <excludetransitive>false</excludetransitive>     <excludescope>test</excludescope>     <includescope>compile</includescope> </configuration> 

i don't want list allowed , not allowed lib's because step newer version takes place every month.

are there other tools can or there dodge that? reply!

big user944849.

it helpful me finding out best solution in case.

for interested in solution, here comes:

at first changed plugin maven-assemby-plugin , added new assembly file

      <plugin>         <groupid>org.apache.maven.plugins</groupid>         <artifactid>maven-assembly-plugin</artifactid>         <version>2.4</version>         <dependencies>            <dependency>             <groupid>com.foobar</groupid>             <artifactid>foobar-parent</artifactid>             <version>${foobar.version}</version>             <type>pom</type>           </dependency>         </dependencies>         <executions>           <execution>             <id>copy-foobar</id>             <phase>package</phase>             <goals>               <goal>single</goal>             </goals>              <configuration>                 <descriptors>                   <descriptor>src/assemble/foobar-libs.xml</descriptor>                 </descriptors>             </configuration>            </execution>           </executions>       </plugin> 

and assembly file looks like:

<assembly   xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"   xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"   xsi:schemalocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">   <id>standalone</id>   <formats>     <format>dir</format>   </formats>   <includebasedirectory>false</includebasedirectory>   <dependencysets>     <dependencyset>       <includes>         <include>org.foobar</include>       </includes>       <outputdirectory>/lib-foobar-${foobar.version}</outputdirectory>       <useprojectartifact>true</useprojectartifact>       <usetransitivefiltering>true</usetransitivefiltering>       <unpack>false</unpack>     </dependencyset>   </dependencysets>  </assembly> 

the key <usetransitivefiltering> element, resolves transitive libs based on included libs.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -