Fix zip compression of libs in layered jars
Closes gh-19792
This commit is contained in:
@@ -110,13 +110,15 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
|
||||
}
|
||||
|
||||
@Test
|
||||
void classpathJarsArePackagedBeneathLibPath() throws IOException {
|
||||
void classpathJarsArePackagedBeneathLibPathAndAreStored() throws IOException {
|
||||
this.task.setMainClassName("com.example.Main");
|
||||
this.task.classpath(jarFile("one.jar"), jarFile("two.jar"));
|
||||
executeTask();
|
||||
try (JarFile jarFile = new JarFile(this.task.getArchiveFile().get().getAsFile())) {
|
||||
assertThat(jarFile.getEntry(this.libPath + "one.jar")).isNotNull();
|
||||
assertThat(jarFile.getEntry(this.libPath + "two.jar")).isNotNull();
|
||||
assertThat(jarFile.getEntry(this.libPath + "one.jar")).isNotNull().extracting(ZipEntry::getMethod)
|
||||
.isEqualTo(ZipEntry.STORED);
|
||||
assertThat(jarFile.getEntry(this.libPath + "two.jar")).isNotNull().extracting(ZipEntry::getMethod)
|
||||
.isEqualTo(ZipEntry.STORED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,6 +411,11 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
|
||||
this.libPath + "third-library.jar");
|
||||
}
|
||||
|
||||
@Test
|
||||
void libEntriesAreStored() throws IOException {
|
||||
|
||||
}
|
||||
|
||||
protected File jarFile(String name) throws IOException {
|
||||
File file = newFile(name);
|
||||
try (JarOutputStream jar = new JarOutputStream(new FileOutputStream(file))) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.io.InputStreamReader;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -100,6 +101,18 @@ class BootJarTests extends AbstractBootArchiveTests<BootJar> {
|
||||
.contains("BOOT-INF/layers/resources/classes/static/test.css");
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenJarIsLayeredJarsInLibAreStored() throws IOException {
|
||||
try (JarFile jarFile = new JarFile(createLayeredJar())) {
|
||||
assertThat(jarFile.getEntry("BOOT-INF/layers/dependencies/lib/first-library.jar").getMethod())
|
||||
.isEqualTo(ZipEntry.STORED);
|
||||
assertThat(jarFile.getEntry("BOOT-INF/layers/dependencies/lib/second-library.jar").getMethod())
|
||||
.isEqualTo(ZipEntry.STORED);
|
||||
assertThat(jarFile.getEntry("BOOT-INF/layers/snapshot-dependencies/lib/third-library-SNAPSHOT.jar")
|
||||
.getMethod()).isEqualTo(ZipEntry.STORED);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenJarIsLayeredClasspathIndexPointsToLayeredLibs() throws IOException {
|
||||
try (JarFile jarFile = new JarFile(createLayeredJar())) {
|
||||
|
||||
Reference in New Issue
Block a user