Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache maven-assembly-plugin or maven-dependency-plugin when foreign jars are needed in runtime [closed]

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.

like image 399
user1589188 Avatar asked Sep 29 '22 20:09

user1589188


1 Answers

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.

like image 103
carlspring Avatar answered Oct 05 '22 23:10

carlspring