From eaa1c0845d0574df04ee11872a382b89ac9d3382 Mon Sep 17 00:00:00 2001 From: eugene yokota Date: Sun, 15 Feb 2026 01:30:52 -0500 Subject: [PATCH] [2.x] fix: Fixes sbt 2.x pluing resolution (#8743) **Problem** Adopting Scala 3.8 on sbt 2.x has created confusing errors with scala-library mismatch, popping up as undefined summon. **Solution** Removing the Provided scope seems to work. --- main/src/main/scala/sbt/Defaults.scala | 10 +++++----- sbt-app/src/sbt-test/plugins/pgp/build.sbt | 1 + sbt-app/src/sbt-test/plugins/pgp/project/plugins.sbt | 3 +-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index ec048292d..23c852d84 100644 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -4371,6 +4371,7 @@ object Classpaths { val sbtMavenSnapshots: MavenRepository = MavenRepository("sbt-maven-snapshot", Resolver.SbtRepositoryRoot + "/" + "maven-snapshots/") + @deprecated("no longer true for sbt 2.x", "2.0.0") def modifyForPlugin(plugin: Boolean, dep: ModuleID): ModuleID = if (plugin) dep.withConfigurations(Some(Provided.name)) else dep @@ -4380,11 +4381,10 @@ object Classpaths { org: String, version: String ): Seq[ModuleID] = - if (auto) - modifyForPlugin(plugin, ScalaArtifacts.libraryDependency(org, version)) - .platform(Platform.jvm) :: Nil - else - Nil + if auto then + if ScalaArtifacts.isScala3(version) then ScalaArtifacts.libraryDependency(org, version) :: Nil + else (modifyForPlugin(plugin, ScalaArtifacts.libraryDependency(org, version)): @nowarn) :: Nil + else Nil def addUnmanagedLibrary: Seq[Setting[?]] = Seq((Compile / unmanagedJars) ++= unmanagedScalaLibrary.value) diff --git a/sbt-app/src/sbt-test/plugins/pgp/build.sbt b/sbt-app/src/sbt-test/plugins/pgp/build.sbt index 9e6b3a95c..c29b2831f 100644 --- a/sbt-app/src/sbt-test/plugins/pgp/build.sbt +++ b/sbt-app/src/sbt-test/plugins/pgp/build.sbt @@ -1 +1,2 @@ scalaVersion := "3.8.1" +publishLocal := {} diff --git a/sbt-app/src/sbt-test/plugins/pgp/project/plugins.sbt b/sbt-app/src/sbt-test/plugins/pgp/project/plugins.sbt index 65b64759c..267a6dd6d 100644 --- a/sbt-app/src/sbt-test/plugins/pgp/project/plugins.sbt +++ b/sbt-app/src/sbt-test/plugins/pgp/project/plugins.sbt @@ -1,2 +1 @@ -// addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1") -libraryDependencies += Defaults.sbtPluginExtra("com.github.sbt" % "sbt-pgp" % "2.3.1", "2", "3.8.1") +addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")