play2war / play2-war-plugin

WAR Plugin for Play framework 2.x
Apache License 2.0
443 stars 71 forks source link

java.util.zip.ZipException: duplicate entry with .m2 and .ivy2 #293

Open tekener opened 9 years ago

tekener commented 9 years ago

We are running into a problem in case that a lib exists in the .m2 and .ivy2 directory. The workaround is to delete the lib in one of the directories.

The exception:

[debug] Webapp resources directory: /e42/buildagent/work/b05723c0abf935c6/app/war
[debug] Embedding /e42/buildagent/work/b05723c0abf935c6/app/war/WEB-INF/web.xml -> /WEB-INF/web.xml
java.util.zip.ZipException: duplicate entry: WEB-INF/lib/org.apache.commons.commons-lang3-3.1.jar
    at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:233)
    at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:109)
    at sbt.IO$.sbt$IO$$addFileEntry$1(IO.scala:445)
    at sbt.IO$$anonfun$sbt$IO$$writeZip$2.apply(IO.scala:454)
    at sbt.IO$$anonfun$sbt$IO$$writeZip$2.apply(IO.scala:454)
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
    at sbt.IO$.sbt$IO$$writeZip(IO.scala:454)
    at sbt.IO$$anonfun$archive$1.apply(IO.scala:410)
    at sbt.IO$$anonfun$archive$1.apply(IO.scala:408)
    at sbt.IO$$anonfun$withZipOutput$1.apply(IO.scala:498)
    at sbt.IO$$anonfun$withZipOutput$1.apply(IO.scala:485)
    at sbt.Using.apply(Using.scala:24)
    at sbt.IO$.withZipOutput(IO.scala:485)
    at sbt.IO$.archive(IO.scala:408)
    at sbt.IO$.jar(IO.scala:392)
    at com.github.play2war.plugin.Play2WarCommands$$anonfun$1.apply(Play2WarCommands.scala:219)
    at com.github.play2war.plugin.Play2WarCommands$$anonfun$1.apply(Play2WarCommands.scala:50)

The debug trace of the war plugin:

[debug] Embedding file /home/teamcity-bui/.m2/repository/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar -> WEB-INF/lib/org.apache.commons.commons-lang3-3.1.jar
[debug] Embedding file /home/teamcity-bui/.ivy2/cache/org.apache.commons/commons-lang3/jars/commons-lang3-3.1.jar -> WEB-INF/lib/org.apache.commons.commons-lang3-3.1.jar
dlecan commented 9 years ago

Do you know why commons-lang3 is present twice in classpath ? (Ivy and M2 dependencies)

tekener commented 9 years ago

I don't have a glue. The build servers are also running maven builds. Thats why we have the jar in both directories. But i don't know why sbt puts the jar twice into the classpath.

dlecan commented 9 years ago

Can you precise:

Thanks

tekener commented 9 years ago

SBT: 0.13.9 Play2war: 1.3-beta3

Thanks

tekener commented 9 years ago

There is a similar bug in sbt: https://github.com/sbt/sbt-native-packager/issues/657