7

Hi which plugin will you use when you need to pack a distribution jar to include all the runtime libraries (jars). These jars content will have to be unpacked into the root path of the distribution jar. Correct versions for these dependencies can be found in the project parent pom.

Or if you may, please compare these two plugins.

carlspring
  • 31,231
  • 29
  • 115
  • 197
user1589188
  • 5,316
  • 17
  • 67
  • 130

2 Answers2

4

You will most-likely need both plugins. If you need to extract some of the dependencies or copy them to a certain location, you will need the maven-dependency-plugin's copy and unpack (or even unpack-dependencies) goals. For the actual packaging, you will need to write an assembly descriptor and use the maven-assembly-plugin.

The maven-assembly-plugin can copy all your dependencies (or some of them) to a specified directory. While this is useful, more often than not, you will need to do something more custom and require a different location (possibly even per dependency).

Both plugins are very useful and are quite often used together as they can complement/facilitate each other's work.

carlspring
  • 31,231
  • 29
  • 115
  • 197
1

Using the maven-assembly-plugin to generate a jar-with-depedencies I've created runnable jar files that include all required dependencies.

The maven-dependency-plugin wasn't needed for this.

Kwebble
  • 2,065
  • 14
  • 23