diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java
index f05dcc47506..8541cee8c4c 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java
@@ -26,6 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* Integration tests for the Maven plugin's jar support.
*
* @author Andy Wilkinson
+ * @author Madhura Bhave
*/
@ExtendWith(MavenBuildExtension.class)
class JarIntegrationTests extends AbstractArchiveIntegrationTests {
@@ -280,4 +281,14 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
});
}
+ @TestTemplate
+ void whenJarIsRepackagedWithTheLayeredLayoutTheJarContainsLayers(MavenBuild mavenBuild) {
+ mavenBuild.project("jar-layered").execute((project) -> {
+ File repackaged = new File(project, "jar/target/jar-layered-0.0.1.BUILD-SNAPSHOT.jar");
+ assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/layers/application/classes/")
+ .hasEntryWithNameStartingWith("BOOT-INF/layers/dependencies/lib/jar-release")
+ .hasEntryWithNameStartingWith("BOOT-INF/layers/snapshot-dependencies/lib/jar-snapshot");
+ });
+ }
+
}
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/jar-release/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/jar-release/pom.xml
new file mode 100644
index 00000000000..a06fe545f18
--- /dev/null
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/jar-release/pom.xml
@@ -0,0 +1,11 @@
+
+
+ 4.0.0
+ org.springframework.boot.maven.it
+ jar-release
+ 0.0.1.RELEASE
+ jar
+ jar
+ Release Jar dependency
+
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/jar-snapshot/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/jar-snapshot/pom.xml
new file mode 100644
index 00000000000..ab31e719baf
--- /dev/null
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/jar-snapshot/pom.xml
@@ -0,0 +1,11 @@
+
+
+ 4.0.0
+ org.springframework.boot.maven.it
+ jar-snapshot
+ 0.0.1.BUILD-SNAPSHOT
+ jar
+ jar
+ Snapshot Jar dependency
+
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/jar/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/jar/pom.xml
new file mode 100644
index 00000000000..31402966ff3
--- /dev/null
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/jar/pom.xml
@@ -0,0 +1,44 @@
+
+
+ 4.0.0
+ org.springframework.boot.maven.it
+ jar-layered
+ 0.0.1.BUILD-SNAPSHOT
+
+ UTF-8
+ @java.version@
+ @java.version@
+
+
+
+
+ @project.groupId@
+ @project.artifactId@
+ @project.version@
+
+
+
+ repackage
+
+
+ LAYERED_JAR
+
+
+
+
+
+
+
+
+ org.springframework.boot.maven.it
+ jar-snapshot
+ 0.0.1.BUILD-SNAPSHOT
+
+
+ org.springframework.boot.maven.it
+ jar-release
+ 0.0.1.RELEASE
+
+
+
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/jar/src/main/java/org/test/SampleApplication.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/jar/src/main/java/org/test/SampleApplication.java
new file mode 100644
index 00000000000..ca2b9a2f0e5
--- /dev/null
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/jar/src/main/java/org/test/SampleApplication.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2012-2020 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.test;
+
+public class SampleApplication {
+
+ public static void main(String[] args) {
+ }
+
+}
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/pom.xml
new file mode 100644
index 00000000000..fdd98953811
--- /dev/null
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered/pom.xml
@@ -0,0 +1,19 @@
+
+
+ 4.0.0
+ org.springframework.boot.maven.it
+ aggregator
+ 0.0.1.BUILD-SNAPSHOT
+ pom
+
+ UTF-8
+ @java.version@
+ @java.version@
+
+
+ jar-snapshot
+ jar-release
+ jar
+
+