Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between Maven Jar Plugin and Maven Assembly Plugin?

People also ask

What is Maven Assembly plugin?

The Assembly Plugin for Maven enables developers to combine project output into a single distributable archive that also contains dependencies, modules, site documentation, and other files. Your project can easily build distribution "assemblies" using one of the prefabricated assembly descriptors.

Why do we need Maven jar plugin?

The maven jar plugin provides the capability to build jars files, if you define that your project is packaged as a jar file, maven will call implicitely to this plugin. We don´t need to define it inside pom. xml it will be downloaded and executed when maven needs it.

What is shaded jar in Maven?

This plugin provides the capability to package the artifact in an uber-jar, including its dependencies and to shade - i.e. rename - the packages of some of the dependencies.


Maven jar plugin simply creates a jar files with all SOURCE files [.class files compiled from .java files] packed in it. However, a jar itself cannot be deployed as it generally has dependencies on 3rd party jar files or other library jar files which are needed to execute SOURCE jar file.

This is where Maven assembly plugin comes into picture. It creates a package of an extension of your choice like .zip, .tar, .gz which is a fully deployable package with all dependencies packed in it. You can also specify directory structure in assembly plugin which should be created when package is deployed on server.

So a assembly plugin is always used in combination with jar plugin.


Maven Jar plugin provides the capability to build and sign jars.The plugin use Maven Archiver to handle jar content and manifest configuration.
Maven Assembly Plugin is used to create all assemblies.

For More Info visit- http://maven.apache.org/plugins/maven-jar-plugin/
                               http://maven.apache.org/plugins/maven-assembly-plugin/