Update classpath index to use jar name instead of full path

See gh-20564
This commit is contained in:
Madhura Bhave
2020-03-25 10:46:10 -07:00
parent 2ceec65b5d
commit ad164269e9
7 changed files with 25 additions and 57 deletions

View File

@@ -164,10 +164,8 @@ class BootJarTests extends AbstractBootArchiveTests<BootJar> {
@Test
void whenJarIsLayeredClasspathIndexPointsToLayeredLibs() throws IOException {
try (JarFile jarFile = new JarFile(createLayeredJar())) {
assertThat(entryLines(jarFile, "BOOT-INF/classpath.idx")).containsExactly(
"BOOT-INF/layers/dependencies/lib/first-library.jar",
"BOOT-INF/layers/dependencies/lib/second-library.jar",
"BOOT-INF/layers/snapshot-dependencies/lib/third-library-SNAPSHOT.jar");
assertThat(entryLines(jarFile, "BOOT-INF/classpath.idx")).containsExactly("first-library.jar",
"second-library.jar", "third-library-SNAPSHOT.jar");
}
}
@@ -189,8 +187,8 @@ class BootJarTests extends AbstractBootArchiveTests<BootJar> {
try (JarFile jarFile = new JarFile(createPopulatedJar())) {
assertThat(jarFile.getManifest().getMainAttributes().getValue("Spring-Boot-Classpath-Index"))
.isEqualTo("BOOT-INF/classpath.idx");
assertThat(entryLines(jarFile, "BOOT-INF/classpath.idx")).containsExactly("BOOT-INF/lib/first-library.jar",
"BOOT-INF/lib/second-library.jar", "BOOT-INF/lib/third-library-SNAPSHOT.jar");
assertThat(entryLines(jarFile, "BOOT-INF/classpath.idx")).containsExactly("first-library.jar",
"second-library.jar", "third-library-SNAPSHOT.jar");
}
}