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
ZipMisc exception with existing directories #84
Comments
Hmm... It's always been a little unclear to me whether The nice thing about ZipMisc, as it is, is that it tries to modify the zip file as little as possible - it just copies entries over wholesale. To make the "names" work, we'll have to first read the whole file upfront to populate names. It looks to me like
or
and now, for whatever reason, for the first time it's seeing
I could be wrong in my diagnosis, but if I'm correct, it seems to me that the easiest fix might be this: } else if (!toOmit.test(entry.getName())) {
// if it isn't being modified, just copy the file stream straight-up
try {
ZipEntry newEntry = new ZipEntry(entry);
newEntry.setCompressedSize(-1);
zipOutput.putNextEntry(newEntry);
copy(zipInput, zipOutput);
} catch (java.util.zip.ZipException e) {
if (e.getMessage().startsWith("duplicate entry")) {
// no worries, sometimes input zips have strange orders, see https://github.com/diffplug/goomph/issues/84
} else {
throw e;
}
} |
further investigation had shown that the order is not the problem. there are indeed duplicate entries within the zip file (ZipOutputStream provided by gradle does support this). My duplicates arise due the following setting:
I did this because IntelliJ does not support the different folders for languages (java, groovy, etc.) like gradle needs. Because i want to use the platform testrunner instead of gradle i need this setting. Though not directly an issue with ZipMisc here, but for me it would be nice to have. |
Sounds like your zip file is gonna have duplicate entries for every file? What's the platform testrunner? The eclipse built-in one? Making this work seems less productive than making it so that you don't need your zips to have duplicate entries. |
Closing due to inactivity. Feel free to reopen. |
I have a module where ZipMisc has a problem saying a path would be duplicate.
there are some resources within my module like:
model/fileA.xyz
model/fileB.xyz
During the BndManifestPlugin
ZipMisc.modify(jarTask.getArchivePath(), toModify, Predicates.alwaysFalse());
it wants to add the files in the following order:model/fileA.xyz
model/fileB.xyz
model/
The last entry is the problem here.
My fix would be to check if the entry already exists in ZipMisc:
The text was updated successfully, but these errors were encountered: