Gradle 2.3 - BootRepackage with Zip64=true cannot find Start-Class

Hello there, this is my first time here. I’m not sure if I have found a bug, but I definitely need help solving this issue. I wasn’t able to execute the war generated from bootRepackage in a project derived from jHipster framework. The topic still opened in Stackoverflow.

I created a small application and put it on Github to help you help me with this. Following these steps I believe you can reproduce the problem also. I’m first packing a simple Spring application and then running the generated war. This will create 66000 files in the resource folder. Packing the same app again will fail because in the second time there is more than 65535 files. We confirmed this by cleaning the resource folder and bootRepackaging it again successfully.

Then I set the zip64 property to true (I had to do it in the jar { } task also. In my original application however I do not have a jar task and set only in the war task). The bootRepackage task completes with success, but then when I run the war I get the no Start-Class error.

Running this for the first time will work, because total files < 65535 and zip64 = false

./gradlew clean bootRepackage; java -jar build/libs/app-0.1-SNAPSHOT.war

Running this for the second time will not work, because total files > 65535 and zip64 = false

./gradlew clean bootRepackage; java -jar build/libs/app-0.1-SNAPSHOT.war

Running this for the third time (equal to alternative one) will work, because total files < 65535 and zip64 = false

rm src/main/resources/*; ./gradlew clean bootRepackage; java -jar build/libs/app-0.1-SNAPSHOT.war

At this point we have total files > 65535 and zip64 = false. We change zip64 property to true and try to bootPackage it again

Set zip64 = true in build.gradle in jar and war tasks.
./gradlew clean bootRepackage; java -jar build/libs/app-0.1-SNAPSHOT.war

java.lang.IllegalStateException: No 'Start-Class' manifest entry specified in jar:file:../boot-repackage-test/build/libs/app-0.1-SNAPSHOT.war!/
        at org.springframework.boot.loader.archive.Archive.getMainClass(Archive.java:57)
        at org.springframework.boot.loader.ExecutableArchiveLauncher.getMainClass(ExecutableArchiveLauncher.java:69)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:61)
        at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:61)

To conclude, unzip app-0.1-SNAPSHOT.war && cat META-INF/MANIFEST.MF yields:

Manifest-Version: 1.0
Start-Class: org.Application
Spring-Boot-Version: 1.2.3.RELEASE
Main-Class: org.springframework.boot.loader.WarLauncher

Best regards,

Pedro Dusso

Looks like Spring Boot uses some custom archive handling code that doesn’t support the Zip64 format. You may want to open up an issue with them.

https://github.com/spring-projects/spring-boot/blob/master/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java

Thanks for the reply Mark; I will drop them a line.