Apache maven-assembly-plugin or maven-dependency-plugin when external jars are needed at runtime

Hi what plugin will you use when you need to build a distribution jar to include all runtime libraries (banners). The contents of these cans will need to be unpacked into the root path of the dispensing basket. The correct versions of these dependencies can be found in the parent pom of the project.

Or, if possible, compare the two plugins.

+3


source to share


2 answers


You will most likely need both plugins. If you need to extract some of the dependencies or copy them to a specific location, you need targets maven-dependency-plugin

copy

and unpack

(or even unpack-dependencies

). For the actual packaging, you will need to write an assembly descriptor and use maven-assembly-plugin

.

maven-assembly-plugin

can copy all your dependencies (or some of them) to the specified directory. While this is useful, more often than not, you will need to do something more conventional and need a different location (perhaps even a dependency).



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

+2


source


Using the maven-assembly-plugin to generate jar-with-dependentcies I have created runnable jar files that contain all the required dependencies.



You don't need the maven-dependency plugin for this.

+1


source







All Articles