assembly-merge-strategy issues using sbt-assembly

前端 未结 7 2111
我寻月下人不归
我寻月下人不归 2020-12-02 23:24

I am trying to convert a scala project into a deployable fat jar using sbt-assembly. When I run my assembly task in sbt I am getting the following error:

Mer         


        
7条回答
  •  借酒劲吻你
    2020-12-02 23:35

    As for the current version 0.11.2 (2014-03-25), the way to define the merge strategy is different.

    This is documented here, the relevant part is:

    NOTE: mergeStrategy in assembly expects a function, you can't do

    mergeStrategy in assembly := MergeStrategy.first
    

    The new way is (copied from the same source):

    mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
      {
        case PathList("javax", "servlet", xs @ _*)         => MergeStrategy.first
        case PathList(ps @ _*) if ps.last endsWith ".html" => MergeStrategy.first
        case "application.conf" => MergeStrategy.concat
        case "unwanted.txt"     => MergeStrategy.discard
        case x => old(x)
      }
    }
    

    This is possibly applicable to earlier versions as well, I don't know exactly when it has changed.

提交回复
热议问题