Scala SBT Assembly cannot merge due to de-duplication error in StaticLoggerBinder.class

后端 未结 2 545
再見小時候
再見小時候 2021-02-08 12:48

My problem is I can no longer use the sbt-assembly plugin because some kind of dependency merge problem creeped in, between a couple people working on this project.

The

2条回答
  •  遥遥无期
    2021-02-08 13:18

    The issue is that more than one dependency brings in slf4j transitive dependency which causes a conflict. The best way is to exclude that transitive dependency instead of using merging strategy of SBT assembly to resolve the conflict.

    First you need to visualize where slf4j comes from (for all top level dependencies). You can use a tool like this sbt-dependency-graph to get a visual diagram of all dependencies. Alternatively you can explore SBT settings from SBT command prompt or use a maven site like this one or this one.

    Once you locate duplicate dependencies use exclude the same way as you use in your build file. Leave only single slf4j transitive dependency. You can also exclude all slf4j transitive dependencies (see here how) and manually add that slf4j dependency at top level.

    Note that if your dependencies require multiple different versions of slf4j it might be problematic to pick a single version that works for all cases. Depends on binary compatibility.

提交回复
热议问题