Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
918 views
in Technique[技术] by (71.8m points)

scala - DeDuplication error with SBT assembly plugin

I am trying to create an executable jar using SBT assembly plugin.

I am ending up with below error :

[error] (app/*:assembly) deduplicate: different file contents found in the following:
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty.orbit/javax.servlet/orbits/javax.servlet-3.0.0.v201112011016.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-continuation/jars/jetty-continuation-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-http/jars/jetty-http-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-io/jars/jetty-io-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-security/jars/jetty-security-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-server/jars/jetty-server-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-servlet/jars/jetty-servlet-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-util/jars/jetty-util-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-webapp/jars/jetty-webapp-8.1.8.v20121106.jar:about.html
[error] /Users/rajeevprasanna/.ivy2/cache/org.eclipse.jetty/jetty-xml/jars/jetty-xml-8.1.8.v20121106.jar:about.html
[error] Total time: 2562 s, completed Dec 5, 2013 12:03:25 PM

After reading wikis of assembly plugin, i have added merge strategy in build.scala file. Seems it is not working. I am not sure whether it is right fix or not. Can someone suggest me the right strategy.

Below is the code which i have in build.scala file :

mergeStrategy in assembly <<= (mergeStrategy in assembly) {
      (old) => {
        case "about.html" => MergeStrategy.discard
        case "logback.xml" => MergeStrategy.first //case PathList("logback.xml") => MergeStrategy.discard
        case x => old(x)
      }
    }

I have coded plugin integration with my app as per this doc : Standalone deployment of Scalatra servlet

I tried diffrent strategies like MergeStrategy.rename and MergeStrategy.deduplicate. But nothing works.. Looking for help...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Your MergeStrategy looks correct. The only unhandled conflicts are "about.html" in the jetty jars, so case "about.html" => MergeStrategy.discard should just do it.

If you're still getting the error, I suspect that re-wiring of the mergeStrategy in assembly setting is either not going in, or going in the wrong order. The only way to know for sure is to see your Build.scala. @Stefan Ollinger's answer to your linked question for example sets up the project as follows:

lazy val project = Project("myProj", file(".")).
  settings(mySettings: _*).
  settings(myAssemblySettings:_*)

Could you post your Build.scala on gist if possible?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...