Skip to content

Commit 43c9a78

Browse files
committed
Merge branch '2.1.x'
2 parents de0c065 + e922cba commit 43c9a78

File tree

5 files changed

+163
-5
lines changed

5 files changed

+163
-5
lines changed

spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ public JarArchiveEntry transform(JarArchiveEntry entry) {
381381
}
382382
if ((entry.getName().startsWith("META-INF/")
383383
&& !entry.getName().equals("META-INF/aop.xml")
384-
&& !entry.getName().endsWith(".kotlin-module"))
384+
&& !entry.getName().endsWith(".kotlin_module"))
385385
|| entry.getName().startsWith("BOOT-INF/")
386386
|| entry.getName().equals("module-info.class")) {
387387
return entry;

spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -679,15 +679,15 @@ public void moduleInfoClassRemainsInRootOfJarWhenRepackaged() throws Exception {
679679
public void kotlinModuleMetadataMovesBeneathBootInfClassesWhenRepackaged()
680680
throws Exception {
681681
this.testJarFile.addClass("A.class", ClassWithMainMethod.class);
682-
this.testJarFile.addFile("META-INF/test.kotlin-module",
683-
this.temporaryFolder.newFile("test.kotlin-module"));
682+
this.testJarFile.addFile("META-INF/test.kotlin_module",
683+
this.temporaryFolder.newFile("test.kotlin_module"));
684684
File source = this.testJarFile.getFile();
685685
File dest = this.temporaryFolder.newFile("dest.jar");
686686
Repackager repackager = new Repackager(source);
687687
repackager.repackage(dest, NO_LIBRARIES);
688688
try (JarFile jarFile = new JarFile(dest)) {
689-
assertThat(jarFile.getEntry("META-INF/test.kotlin-module")).isNull();
690-
assertThat(jarFile.getEntry("BOOT-INF/classes/META-INF/test.kotlin-module"))
689+
assertThat(jarFile.getEntry("META-INF/test.kotlin_module")).isNull();
690+
assertThat(jarFile.getEntry("BOOT-INF/classes/META-INF/test.kotlin_module"))
691691
.isNotNull();
692692
}
693693
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>org.springframework.boot.maven.it</groupId>
6+
<artifactId>jar-with-kotlin-module</artifactId>
7+
<version>0.0.1.BUILD-SNAPSHOT</version>
8+
<properties>
9+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
10+
<maven.compiler.source>@java.version@</maven.compiler.source>
11+
<maven.compiler.target>@java.version@</maven.compiler.target>
12+
</properties>
13+
<build>
14+
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
15+
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
16+
<plugins>
17+
<plugin>
18+
<groupId>@project.groupId@</groupId>
19+
<artifactId>@project.artifactId@</artifactId>
20+
<version>@project.version@</version>
21+
<executions>
22+
<execution>
23+
<goals>
24+
<goal>repackage</goal>
25+
</goals>
26+
<configuration>
27+
<requiresUnpack>
28+
<dependency>
29+
<groupId>org.jetbrains.kotlin</groupId>
30+
<artifactId>kotlin-compiler</artifactId>
31+
</dependency>
32+
</requiresUnpack>
33+
</configuration>
34+
</execution>
35+
</executions>
36+
</plugin>
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-jar-plugin</artifactId>
40+
<version>@maven-jar-plugin.version@</version>
41+
<configuration>
42+
<archive>
43+
<manifestEntries>
44+
<Not-Used>Foo</Not-Used>
45+
</manifestEntries>
46+
</archive>
47+
</configuration>
48+
</plugin>
49+
<plugin>
50+
<groupId>org.jetbrains.kotlin</groupId>
51+
<artifactId>kotlin-maven-plugin</artifactId>
52+
<version>@kotlin.version@</version>
53+
<executions>
54+
<execution>
55+
<id>compile</id>
56+
<phase>process-resources</phase>
57+
<goals>
58+
<goal>compile</goal>
59+
</goals>
60+
</execution>
61+
<execution>
62+
<id>test-compile</id>
63+
<phase>process-test-resources</phase>
64+
<goals>
65+
<goal>compile</goal>
66+
</goals>
67+
</execution>
68+
</executions>
69+
</plugin>
70+
</plugins>
71+
</build>
72+
<dependencies>
73+
<dependency>
74+
<groupId>org.springframework</groupId>
75+
<artifactId>spring-context</artifactId>
76+
<version>@spring.version@</version>
77+
</dependency>
78+
<dependency>
79+
<groupId>javax.servlet</groupId>
80+
<artifactId>javax.servlet-api</artifactId>
81+
<version>@servlet-api.version@</version>
82+
<scope>provided</scope>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.apache.logging.log4j</groupId>
86+
<artifactId>log4j-api</artifactId>
87+
<version>@log4j2.version@</version>
88+
</dependency>
89+
90+
<dependency>
91+
<groupId>org.jetbrains.kotlin</groupId>
92+
<artifactId>kotlin-stdlib-jdk8</artifactId>
93+
<version>@kotlin.version@</version>
94+
</dependency>
95+
<dependency>
96+
<groupId>org.jetbrains.kotlin</groupId>
97+
<artifactId>kotlin-reflect</artifactId>
98+
<version>@kotlin.version@</version>
99+
</dependency>
100+
<dependency>
101+
<groupId>org.jetbrains.kotlin</groupId>
102+
<artifactId>kotlin-compiler</artifactId>
103+
<version>@kotlin.version@</version>
104+
</dependency>
105+
</dependencies>
106+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2012-2019 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
@file:JvmName("SampleApplication")
18+
package org.test;
19+
20+
fun main(args: Array<String>) {
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2012-2019 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import java.io.*;
18+
import org.springframework.boot.maven.*;
19+
20+
File f = new File( basedir, "target/jar-with-kotlin-module-0.0.1.BUILD-SNAPSHOT.jar");
21+
new Verify.JarArchiveVerification(f, Verify.SAMPLE_APP) {
22+
@Override
23+
protected void verifyZipEntries(Verify.ArchiveVerifier verifier) throws Exception {
24+
super.verifyZipEntries(verifier)
25+
verifier.assertHasEntryNameStartingWith("BOOT-INF/classes/META-INF/jar-with-kotlin-module.kotlin_module")
26+
verifier.assertHasUnpackEntry("BOOT-INF/lib/kotlin-compiler-")
27+
verifier.assertHasNonUnpackEntry("BOOT-INF/lib/kotlin-stdlib-")
28+
verifier.assertHasNonUnpackEntry("BOOT-INF/lib/kotlin-reflect-")
29+
}
30+
}.verify();

0 commit comments

Comments
 (0)