diff --git a/build.sc b/build.sc index 7ee71f4fb..d661047b1 100644 --- a/build.sc +++ b/build.sc @@ -144,10 +144,28 @@ class ScalaKernelApi(val crossScalaVersion: String) extends AlmondModule with De scala.`jupyter-api`() ) def ivyDeps = Agg( - Deps.ammoniteCompiler(crossScalaVersion), - Deps.ammoniteReplApi(crossScalaVersion), + Deps.ammoniteCompiler(crossScalaVersion) + .exclude(("org.slf4j", "slf4j-api")), + Deps.ammoniteReplApi(crossScalaVersion) + .exclude(("org.slf4j", "slf4j-api")), Deps.jvmRepr ) + + def resolvedIvyDeps = T { + // Ensure we don't depend on slf4j-api + // As no logger implem would be loaded alongside it by default, slf4j would fail to initialize, + // complain in stderr, and default to NOP logging. + val value = super.resolvedIvyDeps() + val jarNames = value + .map(_.path.last) + .filter(_.endsWith(".jar")) + .map(_.stripSuffix(".jar")) + val slf4jJars = jarNames.filter(_.startsWith("slf4j-")) + if (slf4jJars.nonEmpty) + sys.error(s"Found slf4j JARs: ${slf4jJars.mkString(", ")}") + value + } + def propertyFilePath = "almond/almond.properties" def propertyExtra = Seq( "default-scalafmt-version" -> Deps.scalafmtDynamic.dep.version, @@ -253,6 +271,8 @@ class ScalaKernel(val crossScalaVersion: String) extends AlmondModule with Exter def resolvedIvyDeps = T { // Ensure we stay on slf4j 1.x + // Kind of unnecessary now that scala-kernel-api doesn't bring slf4j-api any more, + // but keeping that just in caseā€¦ val value = super.resolvedIvyDeps() val jarNames = value .map(_.path.last)