fix(RelocateJar): ZipException due to duplicate files
This commit is contained in:
parent
a3445b4482
commit
47fa2ddc0a
|
|
@ -18,6 +18,7 @@ import java.util.jar.JarEntry
|
|||
import java.util.jar.JarFile
|
||||
import java.util.jar.JarOutputStream
|
||||
import java.util.stream.Collectors
|
||||
import java.util.zip.ZipException
|
||||
|
||||
@ToString
|
||||
class RelocateJar extends DefaultTask {
|
||||
|
|
@ -61,10 +62,20 @@ class RelocateJar extends DefaultTask {
|
|||
remapper.remapper = rem
|
||||
reader.accept(rem, 0)
|
||||
isolated.putAll(visitor.isolated)
|
||||
try {
|
||||
out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))
|
||||
} catch(ZipException zipException) {
|
||||
println(zipException)
|
||||
return true
|
||||
}
|
||||
out.write(writer.toByteArray())
|
||||
} else {
|
||||
try {
|
||||
out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))
|
||||
} catch(ZipException zipException) {
|
||||
println(zipException)
|
||||
return true
|
||||
}
|
||||
while ((n = it.read(buf)) != -1) {
|
||||
out.write(buf, 0, n)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue