You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Including a launch script in a Spring Boot far jar using the Maven and Gradle build plugins results in a jar file that is not well formed and is not compatible with some tools (as noted in the Maven plugin documentation).
Apache Commons Compress library utilities like ZipFile.getEntries() fail to find the central directory in such a jar file and return an empty set, which causes issues with other Boot tooling.
Other tools will not recognize the file as a valid jar or zip (notably Go-based programs like pack):
$ pack build docker.io/library/demo --path build/libs/demo-0.0.1-SNAPSHOT.jar
ERROR: invalid app path 'build/libs/demo-0.0.1-SNAPSHOT.jar': app path must be a directory or zip
The Linux zip utility has an option that can be used to fix up the zip directory data to account for the extra launch script data at the beginning of the file:
-A
--adjust-sfx
Adjust self-extracting executable archive. A self-extracting executable archive is
created by prepending the SFX stub to an existing archive. The -A option tells zip to
adjust the entry offsets stored in the archive to take into account this "preamble"
data.
$ zipinfo demo-0.0.1-SNAPSHOT.jar
Archive: demo-0.0.1-SNAPSHOT.jar
Zip file size: 18436305 bytes, number of entries: 129
warning [demo-0.0.1-SNAPSHOT.jar]: 9123 extra bytes at beginning or within zipfile
(attempting to process anyway)
drwxr-xr-x 2.0 unx 0 bX defN 20-Jul-09 17:24 META-INF/
-rw-r--r-- 2.0 unx 485 bl defN 20-Jul-09 17:24 META-INF/MANIFEST.MF
drwxr-xr-x 2.0 unx 0 bl defN 80-Feb-01 00:00 org/
drwxr-xr-x 2.0 unx 0 bl defN 80-Feb-01 00:00 org/springframework/
drwxr-xr-x 2.0 unx 0 bl defN 80-Feb-01 00:00 org/springframework/boot/
...
$ zip --adjust-sfx demo-0.0.1-SNAPSHOT.jar
Zip entry offsets appear off by 9123 bytes - correcting...
$ zipinfo demo-0.0.1-SNAPSHOT.jar
Archive: demo-0.0.1-SNAPSHOT.jar
Zip file size: 18434961 bytes, number of entries: 129
drwxr-xr-x 2.0 unx 0 bx defN 20-Jul-09 17:24 META-INF/
-rw-r--r-- 2.0 unx 485 b- defN 20-Jul-09 17:24 META-INF/MANIFEST.MF
drwxr-xr-x 2.0 unx 0 b- defN 80-Feb-01 00:00 org/
drwxr-xr-x 2.0 unx 0 b- defN 80-Feb-01 00:00 org/springframework/
drwxr-xr-x 2.0 unx 0 b- defN 80-Feb-01 00:00 org/springframework/boot/
...
It would be nice if the build plugins could fix up the jar file in a similar way.
The text was updated successfully, but these errors were encountered:
wilkinsona
changed the title
Adjust far jar directory to account for launch script
Adjust far jar central directory to account for launch script
Jul 27, 2020
scottfrederick
changed the title
Adjust far jar central directory to account for launch script
Adjust fat jar central directory to account for launch script
Jul 30, 2020
An issue has been created in the Apache Commons Compress project to add a feature that would make the fix in Spring Boot very simple. Blocking this issue for now, until we get a response on the Commons Compress issue.
Including a launch script in a Spring Boot far jar using the Maven and Gradle build plugins results in a jar file that is not well formed and is not compatible with some tools (as noted in the Maven plugin documentation).
Apache Commons Compress library utilities like
ZipFile.getEntries()
fail to find the central directory in such a jar file and return an empty set, which causes issues with other Boot tooling.Other tools will not recognize the file as a valid jar or zip (notably Go-based programs like
pack
):The Linux
zip
utility has an option that can be used to fix up the zip directory data to account for the extra launch script data at the beginning of the file:It would be nice if the build plugins could fix up the jar file in a similar way.
The text was updated successfully, but these errors were encountered: