Include source of duplicate path This simple addition to the error message helps to track down JARs supplying identically named resources into a java_binary target.
diff --git a/src/com/facebook/buck/java/JarDirectoryStep.java b/src/com/facebook/buck/java/JarDirectoryStep.java index 4c6894a..4115ae4 100644 --- a/src/com/facebook/buck/java/JarDirectoryStep.java +++ b/src/com/facebook/buck/java/JarDirectoryStep.java
@@ -50,10 +50,25 @@ import java.util.jar.Manifest; import java.util.logging.Level; import java.util.zip.ZipEntry; +import java.util.zip.ZipException; import java.util.zip.ZipFile; import javax.annotation.Nullable; +import com.facebook.buck.step.ExecutionContext; +import com.facebook.buck.step.Step; +import com.facebook.buck.util.DirectoryTraversal; +import com.facebook.buck.util.ProjectFilesystem; +import com.google.common.base.Joiner; +import com.google.common.base.Preconditions; +import com.google.common.base.Throwables; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; +import com.google.common.io.ByteStreams; +import com.google.common.io.Closeables; +import com.google.common.io.Closer; +import com.google.common.io.Files; + /** * Creates a JAR file from a collection of directories/ZIP/JAR files. */ @@ -218,7 +233,13 @@ ZipEntry newEntry = new ZipEntry(entry); newEntry.setCompressedSize(-1); - jar.putNextEntry(newEntry); + try { + jar.putNextEntry(newEntry); + } catch (ZipException ze) { + throw new ZipException(String.format( + "%s from %s", + ze.getMessage(), file.getPath())); + } InputStream inputStream = zip.getInputStream(entry); ByteStreams.copy(inputStream, jar); jar.closeEntry();