Maven dependency plugin copy jar with dependencies

breakline

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?

EJC

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Maven maven-dependency-plugin copy-dependencies ignores outputDirectory

From Java

Maven dependency management for plugin dependencies

From Java

maven-dependency-plugin generates duplicate files in jar-with-dependencies.jar file

From Dev

Maven shade plugin - Jar and dependencies

From

maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e

From Dev

Maven unpack-dependencies of a plugin dependency

From Dev

Maven copy dependencies with full jar name

From Java

Maven to copy JAR when adding dependencies

From Dev

maven dependency:copy-dependencies is renaming incorrectly a .so dependency

From Java

How to exclude dependencies from maven assembly plugin : jar-with-dependencies?

From Dev

How to create a jar with Maven that includes dependencies in a separate folder for each dependency

From Dev

Maven plugin dependencies couldn't resolve dependency from internal repo

From Java

maven-shade-plugin : exclude a dependency and all its transitive dependencies

From Java

Suppress Maven Dependency Plugin's "Unused declared dependencies found" warnings

From Java

Spring boot core dependencies seen as unused by maven-dependency-plugin

From Dev

How does Maven Dependency Plugin determine used dependencies

From Dev

Maven-dependency-plugin (unpack-dependencies) ignores configuration

From Java

maven copy a particular dependency jar to a specific directory in the .war file

From Dev

Maven assembly plugin: dependency jars are not included, fat jar without jars

From Java

Maven jar plugin - Wrong Class-Path entry for SNAPSHOT dependency

From Java

Maven dependency plugin - exclude directories when unpackaging jar file

From Dev

How to use maven assembly plugin to exclude a package from dependency jar?

From Dev

How to copy jar-with-dependencies in my webapp\myfolder in maven Idea

From Java

Maven assembly plugin not producing jar-with-dependencies any more, why?

From Java

Include Maven profile name in assembly-plugin built (with dependencies) jar

From Dev

Eclipse Plugin dependent upon jar and therefore make a plugin from the dependency: what about its dependencies?

From Java

Maven dependency to jar in Nexus

From Java

Maven jar with dependencies?

From Java

Including dependencies in a jar with Maven

Related Related

  1. 1

    Maven maven-dependency-plugin copy-dependencies ignores outputDirectory

  2. 2

    Maven dependency management for plugin dependencies

  3. 3

    maven-dependency-plugin generates duplicate files in jar-with-dependencies.jar file

  4. 4

    Maven shade plugin - Jar and dependencies

  5. 5

    maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e

  6. 6

    Maven unpack-dependencies of a plugin dependency

  7. 7

    Maven copy dependencies with full jar name

  8. 8

    Maven to copy JAR when adding dependencies

  9. 9

    maven dependency:copy-dependencies is renaming incorrectly a .so dependency

  10. 10

    How to exclude dependencies from maven assembly plugin : jar-with-dependencies?

  11. 11

    How to create a jar with Maven that includes dependencies in a separate folder for each dependency

  12. 12

    Maven plugin dependencies couldn't resolve dependency from internal repo

  13. 13

    maven-shade-plugin : exclude a dependency and all its transitive dependencies

  14. 14

    Suppress Maven Dependency Plugin's "Unused declared dependencies found" warnings

  15. 15

    Spring boot core dependencies seen as unused by maven-dependency-plugin

  16. 16

    How does Maven Dependency Plugin determine used dependencies

  17. 17

    Maven-dependency-plugin (unpack-dependencies) ignores configuration

  18. 18

    maven copy a particular dependency jar to a specific directory in the .war file

  19. 19

    Maven assembly plugin: dependency jars are not included, fat jar without jars

  20. 20

    Maven jar plugin - Wrong Class-Path entry for SNAPSHOT dependency

  21. 21

    Maven dependency plugin - exclude directories when unpackaging jar file

  22. 22

    How to use maven assembly plugin to exclude a package from dependency jar?

  23. 23

    How to copy jar-with-dependencies in my webapp\myfolder in maven Idea

  24. 24

    Maven assembly plugin not producing jar-with-dependencies any more, why?

  25. 25

    Include Maven profile name in assembly-plugin built (with dependencies) jar

  26. 26

    Eclipse Plugin dependent upon jar and therefore make a plugin from the dependency: what about its dependencies?

  27. 27

    Maven dependency to jar in Nexus

  28. 28

    Maven jar with dependencies?

  29. 29

    Including dependencies in a jar with Maven

HotTag

Archive