diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java
index 91c05fd09b..454995fe0f 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java
@@ -263,7 +263,8 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
if (!this.outputDirectory.exists()) {
this.outputDirectory.mkdirs();
}
- return new File(this.outputDirectory, this.finalName + classifier + "."
+ String finalName = this.project.getBuild().getFinalName();
+ return new File(this.outputDirectory, finalName + classifier + "."
+ this.project.getArtifact().getArtifactHandler().getExtension());
}
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-disable-attach.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-disable-attach.apt.vm
index 0d39255532..dcd4dfa142 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-disable-attach.apt.vm
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-disable-attach.apt.vm
@@ -23,6 +23,7 @@
${project.version}
+ repackage
repackage
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-name.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-name.apt.vm
new file mode 100644
index 0000000000..3dbd580c23
--- /dev/null
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-name.apt.vm
@@ -0,0 +1,42 @@
+ -----
+ Repackage classifier
+ -----
+ Stephane Nicoll
+ -----
+ 2019-03-29
+ -----
+
+ If you need the repackage jar to have a different local name than the one defined by
+ the <<>> attribute of the project, simply use the standard <<>>
+ as shown in the following example:
+
+---
+
+ ...
+
+ my-app
+
+ ...
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ repackage
+
+ repackage
+
+
+
+ ...
+
+ ...
+
+ ...
+
+ ...
+
+---
+
+ This configuration will generate the repackaged artifact in <<>>.
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt
index 2c0d71d3de..64cd7a049a 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt
@@ -46,6 +46,8 @@ Spring Boot Maven Plugin
* {{{./examples/repackage-classifier.html}Custom repackage classifier}}
+ * {{{./examples/repackage-name.html}Custom repackage name}}
+
* {{{./examples/repackage-disable-attach.html}Local repackaged artifact}}
* {{{./examples/exclude-dependency.html}Exclude a dependency}}
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml
index c393e2ceb6..6711b55c15 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml
@@ -8,6 +8,7 @@