badass-jlink-plugin icon indicating copy to clipboard operation
badass-jlink-plugin copied to clipboard

ZipException: zip END header not found in prepareMergedJarsDir

Open duc0 opened this issue 2 years ago • 1 comments

I'm getting this exception. Any ideas how to troubleshoot this.


Caused by: java.util.zip.ZipException: zip END header not found
        at org.beryx.jlink.util.Util.isEmptyJar(Util.groovy:260)
        at org.beryx.jlink.util.DependencyManager$_closure1$_closure18.doCall(DependencyManager.groovy:70)
        at org.beryx.jlink.util.DependencyManager$_closure1$_closure18.call(DependencyManager.groovy)
        at org.beryx.jlink.util.DependencyManager$_closure1.doCall(DependencyManager.groovy:68)
        at org.beryx.jlink.util.DependencyManager$_closure1.call(DependencyManager.groovy)
        at org.beryx.jlink.util.DependencyManager.<init>(DependencyManager.groovy:67)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at org.beryx.jlink.impl.PrepareMergedJarsDirTaskImpl.execute(PrepareMergedJarsDirTaskImpl.groovy:42)
        at org.beryx.jlink.PrepareMergedJarsDirTask.createMergedModuleAction(PrepareMergedJarsDirTask.groovy:93)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)

duc0 avatar Nov 02 '21 05:11 duc0

It seems that one of your dependencies is not a valid jar. To troubleshoot put this into your root build.gradle:

allprojects {
    task showdeps {
        doFirst {
            configurations.runtimeClasspath.resolvedConfiguration.firstLevelModuleDependencies.each { dep ->
                def jarFiles = ([dep] as Set).collect{ it.moduleArtifacts*.file }.flatten() as Set
                jarFiles.each { f ->
                    println "\n$f"
                    println "\tfile length: ${f.length()}"
                    def zipFile = new java.util.zip.ZipFile(f)
                    println "\tjar file entries: ${zipFile.size()}"
                }
            }
        }
    }
}

Then execute ./gradlew showdeps. I expect it to crash right after printing the path to the problematic dependency.

siordache avatar Nov 02 '21 07:11 siordache