[JAVA] What is Maven Assembly?

Encounter suddenly

I suddenly encountered it at work, so I will give a brief overview.

Reference information Mave Assembly Plugin Maven tips

What is Maven Assembly

Maven Assembly is a Maven plugin used when you want to create an archive file for distribution. It seems that the creation method that can be specified by default is divided into the following three.

Default assembly command

The execution command and the created file are as follows.


$ mvn assembly:assembly -DdescriptorId=bin

$ ls target


$ mvn assembly:assembly -DdescriptorId=jar-with-dependencies

$ ls target


$ mvn assembly:assembly -DdescriptorId=src

$ ls target

Run from pom.xml

That said, it's a hassle to type long commands every time, right? You can specify a default command such as bin for descriptorRef specified in pom.xml. In the sample below, the archive will be executed at the time of mvn package.


            <phase>package</phase> <!--Run at mvn package-->

I want to create my own archive

Of course, you can also customize what you archive. In this case, you can create the archive settings in a separate xml file.


<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" 
    xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd" >

Executing only the original assembly file is as follows. Note that it is Ddescriptor instead of DdescriptorId. Also, in the case of independent execution, an error will occur if the assembly plugin is described in pom.xml, so if you want to try only this, comment out the pom.xml side.

$ mvn assembly:assembly -Ddescriptor=assembly/assembly.xml

If you want to execute it as an extension of pom.xml instead of executing this command, you can use it by specifying the file path in descriptor in configuration below.




If you want to know more details, please refer to the official website that I posted first for various information. Maven can also be used in Kotlin, so maybe there are still more uses?

In addition, when trying Maven Assembly this time, I used the Maven Example Project of Kotlin of JetBrains below. Not only Maven but also gradle version etc., so please have a look. Kotlin hello-world example with maven

Recommended Posts

What is Maven Assembly?
What is maven?
What is Docker?
What is null? ]
What is java
What is Keycloak
What is Jackson?
What is Docker
What is self
What is Jenkins
What is ArgumentMatcher?
What is IM-Juggling?
What is params
What is SLF4J?
What is Facade? ??
What is Java <>?
What is Gradle?
What is POJO
What is Java
What is centOS
What is RubyGem?
What is programming?
What is before_action?
What is Docker
What is Byte?
What is Tomcat
What is `docker-compose up`?
What is a constructor?
What is vue cli
What is an interface?
What is Ruby's self?
What is hard coding?
What is a stream
What is Ruby's attr_accessor?
What is Java Encapsulation?
What is permission denied?
What is instance control?
What is an initializer?
What is Spring Tools 4
What is an operator?
What is object orientation?
What is Guava's @VisibleForTesting?
What is MVC model?
What is an annotation?
What is Java technology?
What is Java API-java
What is @ (instance variable)?
What is Gradle's Artifact?
What is JPA Auditing?
[Swift] What is dismiss?
[Java] What is flatMap?
What is a Servlet?
What is web development?
[Java] What is JavaBeans?
[Android] What is Context? ??
[Java] What is ArrayList?
[Ruby] What is true?
What is object-oriented after all?
Maven default JDK version is 1.5
What is HttpSession session = request.getSession ();
What is Java Assertion? Summary.