I'm trying to copy a jar from my local repository into another project as described here:
http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html
However my jar is coming out of maven-assembly-plugin as a "jar with dependencies", which puts the regular jar and the assembled jar in my local repo. The jar name looks something like:
example-test-0.0.1-SNAPSHOT-jar-with-dependencies.jar
and I can find it in the repo and use it if I copy manually. I thought it would be a good idea to let maven copy it so I used the dependency copy goal described above.
However I cant make it work so it copies the "jar with dependencies" jar.
This is how the pom looks like:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>my.group</groupId>
<artifactId>example-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>libs</outputDirectory>
<destFileName>somename.jar</destFileName>
</artifactItem>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
I tried to set the type to "jar-with-dependencies" but that didnt work. It only worked if I let the type as "jar" but then it copies the regular not assembled jar. Any ideas how to fix this?
If you have an artifact like this:
example-test-0.0.1-SNAPSHOT-jar-with-dependencies.jar
You want to reference it like this:
<artifactItem>
<groupId>my.group</groupId>
<artifactId>example-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
<classifier>jar-with-dependencies</classifier>
<overWrite>true</overWrite>
<outputDirectory>libs</outputDirectory>
<destFileName>somename.jar</destFileName>
</artifactItem>
The example is here:
<artifactItem>
<groupId>[ groupId ]</groupId>
<artifactId>[ artifactId ]</artifactId>
<version>[ version ]</version>
<type>[ packaging ]</type>
this---><classifier> [classifier - optional] </classifier>
<overWrite>[ true or false ]</overWrite>
<outputDirectory>[ output directory ]</outputDirectory>
<destFileName>[ filename ]</destFileName>
</artifactItem>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments