spring-boot:repackage

Full name:

org.springframework.boot:spring-boot-maven-plugin:2.0.5.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.1.
  • Binds by default to the lifecycle phase: package.

Required Parameters

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

Optional Parameters

Name Type Since Description
attach boolean 1.4 Attach the repackaged archive to be installed and deployed.
Default value is: true.
classifier String 1.0 Classifier to add to the artifact generated. If given, the artifact will be attached with that classifier and the main artifact will be deployed as the main artifact. If this is not given (default), it will replace the main artifact and only the repackaged artifact will be deployed. Attaching the artifact allows to deploy it alongside to the original one, see the maven documentation for more details.
embeddedLaunchScript File 1.3 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 Properties that should be expanded in the embedded launch script.
excludeArtifactIds String 1.1 Deprecated. as of 2.0.2 in favour of excludes
User property is: spring-boot.excludeArtifactIds.
excludeDevtools boolean 1.3 Exclude Spring Boot devtools from the repackaged archive.
Default value is: true.
excludeGroupIds String 1.1 Comma separated list of groupId names to exclude (exact match).
User property is: spring-boot.excludeGroupIds.
excludes List 1.1 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 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 Include system scoped dependencies.
Default value is: false.
includes List 1.2 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 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 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 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 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 Skip the execution.
Default value is: false.
User property is: spring-boot.repackage.skip.

Parameter Details

attach:

Attach the repackaged archive to be installed and deployed.
  • Type: boolean
  • Since: 1.4
  • Required: No
  • Default: true

classifier:

Classifier to add to the artifact generated. If given, the artifact will be attached with that classifier and the main artifact will be deployed as the main artifact. If this is not given (default), it will replace the main artifact and only the repackaged artifact will be deployed. 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
  • 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
  • Required: No

embeddedLaunchScriptProperties:

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

excludeArtifactIds:

Deprecated. as of 2.0.2 in favour of excludes
Comma separated list of artifact names to exclude (exact match).
  • Type: java.lang.String
  • Since: 1.1
  • Required: No
  • User Property: spring-boot.excludeArtifactIds

excludeDevtools:

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

excludeGroupIds:

Comma separated list of groupId names to exclude (exact match).
  • Type: java.lang.String
  • Since: 1.1
  • 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
  • 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
  • Required: No
  • Default: false

finalName:

Name of the generated archive.
  • Type: java.lang.String
  • Since: 1.0
  • Required: Yes
  • Default: ${project.build.finalName}

includeSystemScope:

Include system scoped dependencies.
  • Type: boolean
  • Since: 1.4
  • 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
  • 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
  • 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
  • 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
  • Required: No

outputDirectory:

Directory containing the generated archive.
  • Type: java.io.File
  • Since: 1.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
  • Required: No

skip:

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