Skip to content

Commit 27fe148

Browse files
committed
Ignore thin-wrapper jar itself when looking for metadata
1 parent a68dd02 commit 27fe148

File tree

7 files changed

+182
-0
lines changed

7 files changed

+182
-0
lines changed

launcher/src/main/java/org/springframework/boot/loader/thin/PathResolver.java

+4
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,10 @@ private Resource findResource(Archive archive, String pattern) {
423423
for (Resource resource : ResourcePatternUtils.getResourcePatternResolver(new DefaultResourceLoader())
424424
.getResources(archive.getUrl() + pattern)) {
425425
if (resource.exists()) {
426+
if (resource.getFilename() !=null && resource.getFilename().contains("org.springframework.boot.experimental/spring-boot-thin-wrapper")) {
427+
// Explicitly ignore the thin wrapper itself
428+
continue;
429+
}
426430
return resource;
427431
}
428432
}

launcher/src/test/java/org/springframework/boot/loader/thin/PathResolverTests.java

+16
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,20 @@ public void pomWithUnversionedJar() throws Exception {
143143
.endsWith("META-INF/maven/com.example/fake/pom.xml");
144144
}
145145

146+
@Test
147+
public void pomWithThinWrapperJar() throws Exception {
148+
Resource resource = resolver.getPom(
149+
new ExplodedArchive(new File("src/test/resources/apps/with-wrapper.jar")));
150+
assertThat(resource.getURL().toString())
151+
.endsWith("META-INF/maven/com.example/with-wrapper/pom.xml");
152+
}
153+
154+
@Test
155+
public void pomWithOnlyThinWrapperJar() throws Exception {
156+
Resource resource = resolver.getPom(
157+
new ExplodedArchive(new File("src/test/resources/apps/only-wrapper.jar")));
158+
assertThat(resource.getURL().toString())
159+
.endsWith("META-INF/maven/org.springframework.boot.experimental/spring-boot-thin-wrapper/pom.xml");
160+
}
161+
146162
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#Created by Apache Maven 3.5.0
2+
groupId=org.springframework.boot.experimental
3+
artifactId=spring-boot-thin-wrapper
4+
version=1.0.29.RELEASE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>org.springframework.boot.experimental</groupId>
6+
<artifactId>spring-boot-thin-wrapper</artifactId>
7+
<version>1.0.29.RELEASE</version>
8+
<name>Thin Wrapper</name>
9+
<description>Bootstrap wrapper for launching a thin Boot jar</description>
10+
<url>https://spring.io/spring-boot/spring-boot-thin-wrapper</url>
11+
<organization>
12+
<name>Pivotal Software, Inc.</name>
13+
<url>https://www.spring.io</url>
14+
</organization>
15+
<licenses>
16+
<license>
17+
<name>Apache License, Version 2.0</name>
18+
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
19+
<comments>Copyright 2014-2022 the original author or authors.
20+
21+
Licensed under the Apache License, Version 2.0 (the "License");
22+
you may not use this file except in compliance with the License.
23+
You may obtain a copy of the License at
24+
25+
https://www.apache.org/licenses/LICENSE-2.0
26+
27+
Unless required by applicable law or agreed to in writing, software
28+
distributed under the License is distributed on an "AS IS" BASIS,
29+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
30+
implied.
31+
32+
See the License for the specific language governing permissions and
33+
limitations under the License.</comments>
34+
</license>
35+
</licenses>
36+
<developers>
37+
<developer>
38+
<id>dsyer</id>
39+
<name>Dave Syer</name>
40+
<email>dsyer at pivotal.io</email>
41+
<organization>Pivotal Software, Inc.</organization>
42+
<organizationUrl>https://www.spring.io</organizationUrl>
43+
<roles>
44+
<role>lead</role>
45+
</roles>
46+
</developer>
47+
</developers>
48+
<scm>
49+
<connection>scm:git:git://github.com/dsyer/spring-boot-thin-launcher.git/spring-boot-thin-wrapper</connection>
50+
<developerConnection>scm:git:ssh://[email protected]/dsyer/spring-boot-thin-launcher.git/spring-boot-thin-wrapper</developerConnection>
51+
<url>https://github.com/dsyer/spring-boot-thin-launcher/spring-boot-thin-wrapper</url>
52+
</scm>
53+
<distributionManagement>
54+
<repository>
55+
<id>repo.spring.io</id>
56+
<name>Spring Release Repository</name>
57+
<url>https://repo.spring.io/libs-release-local</url>
58+
</repository>
59+
<snapshotRepository>
60+
<id>repo.spring.io</id>
61+
<name>Spring Snapshot Repository</name>
62+
<url>https://repo.spring.io/libs-snapshot-local</url>
63+
</snapshotRepository>
64+
<site>
65+
<id>spring-docs</id>
66+
<url>scp://static.springframework.org/var/www/domains/springframework.org/static/htdocs/spring-boot/docs/spring-boot-thin-wrapper/1.0.29.RELEASE/spring-boot-thin-wrapper</url>
67+
</site>
68+
<downloadUrl>https://github.com/spring-projects</downloadUrl>
69+
</distributionManagement>
70+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>com.example</groupId>
7+
<artifactId>simple</artifactId>
8+
<version>0.0.1-SNAPSHOT</version>
9+
<packaging>jar</packaging>
10+
11+
<name>simple</name>
12+
<description>Demo project for Spring Boot</description>
13+
14+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#Created by Apache Maven 3.5.0
2+
groupId=org.springframework.boot.experimental
3+
artifactId=spring-boot-thin-wrapper
4+
version=1.0.29.RELEASE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>org.springframework.boot.experimental</groupId>
6+
<artifactId>spring-boot-thin-wrapper</artifactId>
7+
<version>1.0.29.RELEASE</version>
8+
<name>Thin Wrapper</name>
9+
<description>Bootstrap wrapper for launching a thin Boot jar</description>
10+
<url>https://spring.io/spring-boot/spring-boot-thin-wrapper</url>
11+
<organization>
12+
<name>Pivotal Software, Inc.</name>
13+
<url>https://www.spring.io</url>
14+
</organization>
15+
<licenses>
16+
<license>
17+
<name>Apache License, Version 2.0</name>
18+
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
19+
<comments>Copyright 2014-2022 the original author or authors.
20+
21+
Licensed under the Apache License, Version 2.0 (the "License");
22+
you may not use this file except in compliance with the License.
23+
You may obtain a copy of the License at
24+
25+
https://www.apache.org/licenses/LICENSE-2.0
26+
27+
Unless required by applicable law or agreed to in writing, software
28+
distributed under the License is distributed on an "AS IS" BASIS,
29+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
30+
implied.
31+
32+
See the License for the specific language governing permissions and
33+
limitations under the License.</comments>
34+
</license>
35+
</licenses>
36+
<developers>
37+
<developer>
38+
<id>dsyer</id>
39+
<name>Dave Syer</name>
40+
<email>dsyer at pivotal.io</email>
41+
<organization>Pivotal Software, Inc.</organization>
42+
<organizationUrl>https://www.spring.io</organizationUrl>
43+
<roles>
44+
<role>lead</role>
45+
</roles>
46+
</developer>
47+
</developers>
48+
<scm>
49+
<connection>scm:git:git://github.com/dsyer/spring-boot-thin-launcher.git/spring-boot-thin-wrapper</connection>
50+
<developerConnection>scm:git:ssh://[email protected]/dsyer/spring-boot-thin-launcher.git/spring-boot-thin-wrapper</developerConnection>
51+
<url>https://github.com/dsyer/spring-boot-thin-launcher/spring-boot-thin-wrapper</url>
52+
</scm>
53+
<distributionManagement>
54+
<repository>
55+
<id>repo.spring.io</id>
56+
<name>Spring Release Repository</name>
57+
<url>https://repo.spring.io/libs-release-local</url>
58+
</repository>
59+
<snapshotRepository>
60+
<id>repo.spring.io</id>
61+
<name>Spring Snapshot Repository</name>
62+
<url>https://repo.spring.io/libs-snapshot-local</url>
63+
</snapshotRepository>
64+
<site>
65+
<id>spring-docs</id>
66+
<url>scp://static.springframework.org/var/www/domains/springframework.org/static/htdocs/spring-boot/docs/spring-boot-thin-wrapper/1.0.29.RELEASE/spring-boot-thin-wrapper</url>
67+
</site>
68+
<downloadUrl>https://github.com/spring-projects</downloadUrl>
69+
</distributionManagement>
70+
</project>

0 commit comments

Comments
 (0)