From 9786906eca956e185edfbb0be23dc35d7065967e Mon Sep 17 00:00:00 2001 From: Roberto Tyley Date: Fri, 17 Sep 2021 17:36:04 +0100 Subject: [PATCH] Avoid repeating versions in Eviction error message Rather than seeing an error like this, with the evicted version numbers being repeated many times: ``` [error] * org.scala-lang.modules:scala-java8-compat_2.13:1.0.0 (early-semver) is selected over {0.9.0, 0.9.0, 0.9.0, 0.9.0, 0.9.1, 0.9.1, 0.9.1} ``` ...I'd much rather see an error like this: ``` [error] * org.scala-lang.modules:scala-java8-compat_2.13:1.0.0 (early-semver) is selected over {0.9.0, 0.9.1} ``` --- core/src/main/scala/sbt/librarymanagement/EvictionError.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/sbt/librarymanagement/EvictionError.scala b/core/src/main/scala/sbt/librarymanagement/EvictionError.scala index aaf926dec..94a7f38e5 100644 --- a/core/src/main/scala/sbt/librarymanagement/EvictionError.scala +++ b/core/src/main/scala/sbt/librarymanagement/EvictionError.scala @@ -155,7 +155,8 @@ final class EvictionError private[sbt] ( evictions.foreach({ case (a, scheme) => val revs = a.evicteds map { _.module.revision } - val revsStr = if (revs.size <= 1) revs.mkString else "{" + revs.mkString(", ") + "}" + val revsStr = + if (revs.size <= 1) revs.mkString else "{" + revs.distinct.mkString(", ") + "}" val seen: mutable.Set[ModuleID] = mutable.Set() val callers: List[String] = (a.evicteds.toList ::: a.winner.toList) flatMap { r => val rev = r.module.revision