現象
SBTのversion conflict(s)解消方法まとめ - Qiita
に書かれた方法などでライブラリの衝突(conflict)を解決していたのに、sbtのバージョンを1.2.0以降に上げたら次のwarningが頻繁に出るようになってしまった。
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
原因
sbt 1.2.0で導入されたwarnEvictionSummary
という機能の実装が少しまずいのが原因。
warnを出すべきでないバージョン衝突1までwarningを出してしまっている。
- Inconsistent log level of eviction warning summary · Issue #287 · sbt/librarymanagement
- [Fix #287] Eviction warning summary shows only binary incompatible by bigwheel · Pull Request #288 · sbt/librarymanagement
解決策
上記の修正が含まれたバージョンのsbtが出るまでは以下を build.sbt2 に書くことでwarningを抑制できる。
evictionWarningOptions in update := EvictionWarningOptions.default.withWarnEvictionSummary(false)
これでeviction warning summaryがでなくなるんじゃないかと心配かもしれないが、
https://github.com/sbt/librarymanagement/blob/v1.2.4/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala#L317
の実装上eviction summaryが有効だろうが無効だろうがbinary compatibilityがない危険なconflictはどちらにしろwarningが出るので安心していい。
逆に上の修正が入ったあとのバージョンのsbtでは本当にeviction summaryがでなくなってしまうので、この設定は必ず取り除くこと。