Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

重复文件导致的ZipException #4

Open
Itsusinn opened this issue Jul 29, 2021 · 1 comment
Open

重复文件导致的ZipException #4

Itsusinn opened this issue Jul 29, 2021 · 1 comment

Comments

@Itsusinn
Copy link

Itsusinn commented Jul 29, 2021

当依赖中有相同文件时,会产生ZipException
当重复文件是class文件时

Caused by: java.util.zip.ZipException: duplicate entry: module-info.class
	at java_util_jar_JarOutputStream$putNextEntry.call(Unknown Source)
	at io.izzel.taboolib.gradle.RelocateJar$_relocate_closure2$_closure8$_closure9$_closure10.doCall(RelocateJar.groovy:65)
	at jdk.internal.reflect.GeneratedMethodAccessor519.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at jdk.internal.reflect.GeneratedMethodAccessor517.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at io.izzel.taboolib.gradle.RelocateJar$_relocate_closure2$_closure8$_closure9.doCall(RelocateJar.groovy:56)
	at jdk.internal.reflect.GeneratedMethodAccessor518.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at io.izzel.taboolib.gradle.RelocateJar$_relocate_closure2$_closure8.doCall(RelocateJar.groovy:55)
	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 jdk.internal.reflect.GeneratedMethodAccessor517.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at io.izzel.taboolib.gradle.RelocateJar$_relocate_closure2.doCall(RelocateJar.groovy:54)
	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 jdk.internal.reflect.GeneratedMethodAccessor517.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at io.izzel.taboolib.gradle.RelocateJar.relocate(RelocateJar.groovy:51)
	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)

out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))

这种情况通常是由于依赖错误地将其依赖打包到artifact内,或module-info.class

当重复文件不是class时

Caused by: java.util.zip.ZipException: duplicate entry: LICENSE.txt
	at java_util_jar_JarOutputStream$putNextEntry.call(Unknown Source)
	at io.izzel.taboolib.gradle.RelocateJar$_relocate_closure2$_closure8$_closure9$_closure10.doCall(RelocateJar.groovy:67)
	at jdk.internal.reflect.GeneratedMethodAccessor837.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at jdk.internal.reflect.GeneratedMethodAccessor145.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at io.izzel.taboolib.gradle.RelocateJar$_relocate_closure2$_closure8$_closure9.doCall(RelocateJar.groovy:55)
	at jdk.internal.reflect.GeneratedMethodAccessor836.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at io.izzel.taboolib.gradle.RelocateJar$_relocate_closure2$_closure8.doCall(RelocateJar.groovy:54)
	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 jdk.internal.reflect.GeneratedMethodAccessor145.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at io.izzel.taboolib.gradle.RelocateJar$_relocate_closure2.doCall(RelocateJar.groovy:53)
	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 jdk.internal.reflect.GeneratedMethodAccessor145.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at io.izzel.taboolib.gradle.RelocateJar.relocate(RelocateJar.groovy:50)
	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)

out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))

这种情况下,重复文件一般为LICENSE,NOTICE等

@Itsusinn
Copy link
Author

Itsusinn commented Jul 29, 2021

PR: #5
临时方案:
跳过该重复文件并输出ZipException(包含重复文件位置)

@Itsusinn Itsusinn changed the title ZipException due to duplicate files 重复文件导致的ZipException Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant