2

I am trying to pack one of the modules of my application into a war. I have chosen xsbt-web-plugin to help me out.

I have prepared the sbt, I guess correctly:

lazy val `my-project` = (project in file("my-project"))
                         ...
                         .enablePlugins(TomcatPlugin)

But during sbt package I get this error:

[info] Packaging /home/siatkowskim/Documents/....target/scala-2.11/my-project_2.11-1.2-SNAPSHOT.war ...
[error] java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF

I am familiar with sbt-assembly but I see no way of deduplication here. How can I even debug, where is it duplicated from? Or how to solve this duplication?

Atais
  • 10,857
  • 6
  • 71
  • 111

2 Answers2

1

Turned out I had MANIFEST.MF file in my classpath. I do not know what it was for, but removing it solved the problem.

Atais
  • 10,857
  • 6
  • 71
  • 111
1

I have the same issue, yet I had no evident MANIFEST.MF file in my classpath. I can only suppose that it was coming from the multitude of .jar files included.

The following solved the problem:

assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs @ _*) =>
  (xs map {_.toLowerCase}) match {
    case ("manifest.mf" :: Nil) | ("index.list" :: Nil) | ("dependencies" :: Nil) => MergeStrategy.discard
    case _ => MergeStrategy.last
  }
}

See here to understand what the double colon notation means.

user1485864
  • 499
  • 6
  • 18