Maven - Assembly (Plugin)

Card Puncher Data Processing

About

The assembly plugin will build assembly.

An “assembly” is a group of files, directories, and dependencies that are assembled into an archive format and distributed.

The plugin goals documentation can be found here.

Pom.xml

The whole plugin is made through Descriptor Files.

Descriptor Files

Custom

<project>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <descriptors>
            <descriptor>src/main/assembly/myDescriptor.xml</descriptor>
          </descriptors>
        </configuration>
        [...]
</project>

Descriptor Reference

Pre-defined

There is 4 Pre-defined Descriptor Files:

  • bin: to create a binary distribution archive of your project.
  • jar-with-dependencies: to create a JAR which contains the binary output of your project See shade
  • src: to create source archives for your project
  • project: produce an assembly containing the entire project, minus any build output that lands in the target directory.

Example in the pom.xml with the jar-with-dependencies (See the descriptorRefs element)

<project>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <!-- NOTE: We don't need a groupId specification because the group is
             org.apache.maven.plugins ...which is assumed by default.
         -->
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
        </configuration>
        [...]
</project>

Documentation / Reference





Discover More
Gradle - Application Plugin

The Application plugin allows you to: get all applications JARs as well as all of their transitive dependencies add two startup scripts (one for UNIX-like operations systems and one for Windows)...
Card Puncher Data Processing
Maven - Install (Local Package Installation)

Install is a phase that install the generated artifact in the local repository. deploy Plugin that can be used in this phase. install...
Card Puncher Data Processing
Maven - JRE (Including it in your distribution)

A JRE is just a dependency Therefore you can upload it to a repository and use it in your build. With a file named jre-1.7.80-windows-x64.zip, we will get the following artifact coordinates: ...
Card Puncher Data Processing
Maven - Package

Packaging in Maven. Package is a phase that bundle the code in a way suitable to be distributed. By default, this phase will take the compiled code and make an archive of it as define in the packaging...



Share this page:
Follow us:
Task Runner