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

[binary.jvm] ZipException raised with zip that have different entries with the same name #7806

Closed
lgirault opened this issue May 27, 2019 · 0 comments

Comments

@lgirault
Copy link

The task binary.jvm calls the cli org.pantsbuild.tools.jar.Main. If the target of the task has a jar dependency that contains different entries with the same name (e.g: http://central.maven.org/maven2/org/seleniumhq/selenium/htmlunit-driver/2.27/htmlunit-driver-2.27.jar ) the cli will raise an exception : Unexpected problem writing target jar target.jar: java.util.zip.ZipException: invalid entry size (expected x but got y bytes)

To reproduce use the following BUILD

jar_library(name='htmlunit-driver',
  jars=[
    jar(org='org.seleniumhq.selenium',
    name='htmlunit-driver',
    rev='2.27'),
  ],
)
jvm_binary(
    name='bug',
    dependencies=[':htmlunit-driver']
    )

and assuming the file is bug/BUILD type ./pants binary.jvm bug.

To find out the exact problem I used the following utils :
unizip -t htmlunit-driver-2.27.jar -> you can see duplicated entry
zip -d htmlunit-driver-2.27.jar "org/*" -> remove non problematic file to make next comand output more readable
zipdetails htmlunit-driver-2.27.jar you can see that pom.properties do not have the same CRC (pom.xml is also duplicated but they are identical and this does not make the cli to crash)

@benjyw benjyw closed this as completed Jul 17, 2020
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

2 participants