Adjust fat jar central directory to account for launch script

An upgrade to Apache Commons Compress allows the build plugins to write
the launch script to the fat jar as a proper preamble, making the file
compatible with more jar and zip tooling.

Fixes gh-22336
This commit is contained in:
Scott Frederick
2021-07-19 15:02:05 -05:00
parent b5ef5a2d90
commit 9f001efa29
11 changed files with 36 additions and 46 deletions

View File

@@ -74,13 +74,12 @@ public class ZipFileTarArchive implements TarArchive {
tar.finish();
}
private void assertArchiveHasEntries(File jarFile) {
try (ZipFile zipFile = new ZipFile(jarFile)) {
Assert.state(zipFile.getEntries().hasMoreElements(), () -> "File '" + jarFile
+ "' is not compatible with buildpacks; ensure jar file is valid and launch script is not enabled");
private void assertArchiveHasEntries(File file) {
try (ZipFile zipFile = new ZipFile(file)) {
Assert.state(zipFile.getEntries().hasMoreElements(), () -> "Archive file '" + file + "' is not valid");
}
catch (IOException ex) {
throw new IllegalStateException("File '" + jarFile + "' is not readable", ex);
throw new IllegalStateException("File '" + file + "' is not readable", ex);
}
}