spring-boot:repackage

Full name:

org.springframework.boot:spring-boot-maven-plugin:2.1.13.RELEASE:repackage

Description:

Repackages existing JAR and WAR archives so that they can be executed from the command line using java -jar. With layout=NONE can also be used simply to package a JAR with nested dependencies (and no main class, so not executable).

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: compile+runtime.
  • Since version: 1.0.0.
  • Binds by default to the lifecycle phase: package.

Required Parameters

Name Type Since Description
outputDirectory File 1.0.0 Directory containing the generated archive.
Default value is: ${project.build.directory}.

Optional Parameters

Name Type Since Description
attach boolean 1.4.0 Attach the repackaged archive to be installed into your local Maven repository or deployed to a remote repository. If no classifier has been configured, it will replace the normal jar. If a classifier has been configured such that the normal jar and the repackaged jar are different, it will be attached alongside the normal jar. When the property is set to false, the repackaged archive will not be installed or deployed.
Default value is: true.
classifier String 1.0.0 Classifier to add to the repackaged archive. If not given, the main artifact will be replaced by the repackaged archive. If given, the classifier will also be used to determine the source archive to repackage: if an artifact with that classifier already exists, it will be used as source and replaced. If no such artifact exists, the main artifact will be used as source and the repackaged archive will be attached as a supplemental artifact with that classifier. Attaching the artifact allows to deploy it alongside to the original one, see the maven documentation for more details.
embeddedLaunchScript File 1.3.0 The embedded launch script to prepend to the front of the jar if it is fully executable. If not specified the 'Spring Boot' default script will be used.
embeddedLaunchScriptProperties Properties 1.3.0 Properties that should be expanded in the embedded launch script.
excludeDevtools boolean 1.3.0 Exclude Spring Boot devtools from the repackaged archive.
Default value is: true.
excludeGroupIds String 1.1.0 Comma separated list of groupId names to exclude (exact match).
User property is: spring-boot.excludeGroupIds.
excludes List 1.1.0 Collection of artifact definitions to exclude. The Exclude element defines a groupId and artifactId mandatory properties and an optional classifier property.
User property is: spring-boot.excludes.
executable boolean 1.3.0 Make a fully executable jar for *nix machines by prepending a launch script to the jar.

Currently, some tools do not accept this format so you may not always be able to use this technique. For example, jar -xf may silently fail to extract a jar or war that has been made fully-executable. It is recommended that you only enable this option if you intend to execute it directly, rather than running it with java -jar or deploying it to a servlet container.


Default value is: false.
includeSystemScope boolean 1.4.0 Include system scoped dependencies.
Default value is: false.
includes List 1.2.0 Collection of artifact definitions to include. The Include element defines a groupId and artifactId mandatory properties and an optional classifier property.
User property is: spring-boot.includes.
layout RepackageMojo$LayoutType 1.0.0 The type of archive (which corresponds to how the dependencies are laid out inside it). Possible values are JAR, WAR, ZIP, DIR, NONE. Defaults to a guess based on the archive type.
layoutFactory LayoutFactory 1.5.0 The layout factory that will be used to create the executable archive if no explicit layout is set. Alternative layouts implementations can be provided by 3rd parties.
mainClass String 1.0.0 The name of the main class. If not specified the first compiled class found that contains a 'main' method will be used.
requiresUnpack List 1.1.0 A list of the libraries that must be unpacked from fat jars in order to run. Specify each library as a <dependency> with a <groupId> and a <artifactId> and they will be unpacked at runtime.
skip boolean 1.2.0 Skip the execution.
Default value is: false.
User property is: spring-boot.repackage.skip.

Parameter Details

attach:

Attach the repackaged archive to be installed into your local Maven repository or deployed to a remote repository. If no classifier has been configured, it will replace the normal jar. If a classifier has been configured such that the normal jar and the repackaged jar are different, it will be attached alongside the normal jar. When the property is set to false, the repackaged archive will not be installed or deployed.
  • Type: boolean
  • Since: 1.4.0
  • Required: No
  • Default: true

classifier:

Classifier to add to the repackaged archive. If not given, the main artifact will be replaced by the repackaged archive. If given, the classifier will also be used to determine the source archive to repackage: if an artifact with that classifier already exists, it will be used as source and replaced. If no such artifact exists, the main artifact will be used as source and the repackaged archive will be attached as a supplemental artifact with that classifier. Attaching the artifact allows to deploy it alongside to the original one, see the maven documentation for more details.
  • Type: java.lang.String
  • Since: 1.0.0
  • Required: No

embeddedLaunchScript:

The embedded launch script to prepend to the front of the jar if it is fully executable. If not specified the 'Spring Boot' default script will be used.
  • Type: java.io.File
  • Since: 1.3.0
  • Required: No

embeddedLaunchScriptProperties:

Properties that should be expanded in the embedded launch script.
  • Type: java.util.Properties
  • Since: 1.3.0
  • Required: No

excludeDevtools:

Exclude Spring Boot devtools from the repackaged archive.
  • Type: boolean
  • Since: 1.3.0
  • Required: No
  • Default: true

excludeGroupIds:

Comma separated list of groupId names to exclude (exact match).
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • User Property: spring-boot.excludeGroupIds

excludes:

Collection of artifact definitions to exclude. The Exclude element defines a groupId and artifactId mandatory properties and an optional classifier property.
  • Type: java.util.List
  • Since: 1.1.0
  • Required: No
  • User Property: spring-boot.excludes

executable:

Make a fully executable jar for *nix machines by prepending a launch script to the jar.

Currently, some tools do not accept this format so you may not always be able to use this technique. For example, jar -xf may silently fail to extract a jar or war that has been made fully-executable. It is recommended that you only enable this option if you intend to execute it directly, rather than running it with java -jar or deploying it to a servlet container.

  • Type: boolean
  • Since: 1.3.0
  • Required: No
  • Default: false

includeSystemScope:

Include system scoped dependencies.
  • Type: boolean
  • Since: 1.4.0
  • Required: No
  • Default: false

includes:

Collection of artifact definitions to include. The Include element defines a groupId and artifactId mandatory properties and an optional classifier property.
  • Type: java.util.List
  • Since: 1.2.0
  • Required: No
  • User Property: spring-boot.includes

layout:

The type of archive (which corresponds to how the dependencies are laid out inside it). Possible values are JAR, WAR, ZIP, DIR, NONE. Defaults to a guess based on the archive type.
  • Type: org.springframework.boot.maven.RepackageMojo$LayoutType
  • Since: 1.0.0
  • Required: No

layoutFactory:

The layout factory that will be used to create the executable archive if no explicit layout is set. Alternative layouts implementations can be provided by 3rd parties.
  • Type: org.springframework.boot.loader.tools.LayoutFactory
  • Since: 1.5.0
  • Required: No

mainClass:

The name of the main class. If not specified the first compiled class found that contains a 'main' method will be used.
  • Type: java.lang.String
  • Since: 1.0.0
  • Required: No

outputDirectory:

Directory containing the generated archive.
  • Type: java.io.File
  • Since: 1.0.0
  • Required: Yes
  • Default: ${project.build.directory}

requiresUnpack:

A list of the libraries that must be unpacked from fat jars in order to run. Specify each library as a <dependency> with a <groupId> and a <artifactId> and they will be unpacked at runtime.
  • Type: java.util.List
  • Since: 1.1.0
  • Required: No

skip:

Skip the execution.
  • Type: boolean
  • Since: 1.2.0
  • Required: No
  • User Property: spring-boot.repackage.skip
  • Default: false