diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java
index 355f3c7c868c..08246f5401f9 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java
+++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java
@@ -381,7 +381,7 @@ public JarArchiveEntry transform(JarArchiveEntry entry) {
}
if ((entry.getName().startsWith("META-INF/")
&& !entry.getName().equals("META-INF/aop.xml")
- && !entry.getName().endsWith(".kotlin-module"))
+ && !entry.getName().endsWith(".kotlin_module"))
|| entry.getName().startsWith("BOOT-INF/")
|| entry.getName().equals("module-info.class")) {
return entry;
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java
index 778bf33ee932..a28925c16c67 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java
+++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java
@@ -679,15 +679,15 @@ public void moduleInfoClassRemainsInRootOfJarWhenRepackaged() throws Exception {
public void kotlinModuleMetadataMovesBeneathBootInfClassesWhenRepackaged()
throws Exception {
this.testJarFile.addClass("A.class", ClassWithMainMethod.class);
- this.testJarFile.addFile("META-INF/test.kotlin-module",
- this.temporaryFolder.newFile("test.kotlin-module"));
+ this.testJarFile.addFile("META-INF/test.kotlin_module",
+ this.temporaryFolder.newFile("test.kotlin_module"));
File source = this.testJarFile.getFile();
File dest = this.temporaryFolder.newFile("dest.jar");
Repackager repackager = new Repackager(source);
repackager.repackage(dest, NO_LIBRARIES);
try (JarFile jarFile = new JarFile(dest)) {
- assertThat(jarFile.getEntry("META-INF/test.kotlin-module")).isNull();
- assertThat(jarFile.getEntry("BOOT-INF/classes/META-INF/test.kotlin-module"))
+ assertThat(jarFile.getEntry("META-INF/test.kotlin_module")).isNull();
+ assertThat(jarFile.getEntry("BOOT-INF/classes/META-INF/test.kotlin_module"))
.isNotNull();
}
}
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-kotlin-module/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-kotlin-module/pom.xml
new file mode 100644
index 000000000000..1ce66c36bff3
--- /dev/null
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-kotlin-module/pom.xml
@@ -0,0 +1,106 @@
+
+
+ 4.0.0
+ org.springframework.boot.maven.it
+ jar-with-kotlin-module
+ 0.0.1.BUILD-SNAPSHOT
+
+ UTF-8
+ @java.version@
+ @java.version@
+
+
+ ${project.basedir}/src/main/kotlin
+ ${project.basedir}/src/test/kotlin
+
+
+ @project.groupId@
+ @project.artifactId@
+ @project.version@
+
+
+
+ repackage
+
+
+
+
+ org.jetbrains.kotlin
+ kotlin-compiler
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ @maven-jar-plugin.version@
+
+
+
+ Foo
+
+
+
+
+
+ org.jetbrains.kotlin
+ kotlin-maven-plugin
+ @kotlin.version@
+
+
+ compile
+ process-resources
+
+ compile
+
+
+
+ test-compile
+ process-test-resources
+
+ compile
+
+
+
+
+
+
+
+
+ org.springframework
+ spring-context
+ @spring.version@
+
+
+ javax.servlet
+ javax.servlet-api
+ @servlet-api.version@
+ provided
+
+
+ org.apache.logging.log4j
+ log4j-api
+ @log4j2.version@
+
+
+
+ org.jetbrains.kotlin
+ kotlin-stdlib-jdk8
+ @kotlin.version@
+
+
+ org.jetbrains.kotlin
+ kotlin-reflect
+ @kotlin.version@
+
+
+ org.jetbrains.kotlin
+ kotlin-compiler
+ @kotlin.version@
+
+
+
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-kotlin-module/src/main/kotlin/org/test/SampleApplication.kt b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-kotlin-module/src/main/kotlin/org/test/SampleApplication.kt
new file mode 100644
index 000000000000..696095f42a74
--- /dev/null
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-kotlin-module/src/main/kotlin/org/test/SampleApplication.kt
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2012-2019 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
+ *
+ * http://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.
+ */
+
+@file:JvmName("SampleApplication")
+package org.test;
+
+fun main(args: Array) {
+
+}
\ No newline at end of file
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-kotlin-module/verify.groovy b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-kotlin-module/verify.groovy
new file mode 100644
index 000000000000..764a89bf5639
--- /dev/null
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-kotlin-module/verify.groovy
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2012-2019 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
+ *
+ * http://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.
+ */
+
+import java.io.*;
+import org.springframework.boot.maven.*;
+
+File f = new File( basedir, "target/jar-with-kotlin-module-0.0.1.BUILD-SNAPSHOT.jar");
+new Verify.JarArchiveVerification(f, Verify.SAMPLE_APP) {
+ @Override
+ protected void verifyZipEntries(Verify.ArchiveVerifier verifier) throws Exception {
+ super.verifyZipEntries(verifier)
+ verifier.assertHasEntryNameStartingWith("BOOT-INF/classes/META-INF/jar-with-kotlin-module.kotlin_module")
+ verifier.assertHasUnpackEntry("BOOT-INF/lib/kotlin-compiler-")
+ verifier.assertHasNonUnpackEntry("BOOT-INF/lib/kotlin-stdlib-")
+ verifier.assertHasNonUnpackEntry("BOOT-INF/lib/kotlin-reflect-")
+ }
+}.verify();