-
Notifications
You must be signed in to change notification settings - Fork 1k
cross-building sbt plugins: updateSbtClassifiers fails downloading wrong scripted-plugin artifact when scalaVersion is explicitly set in build.sbt #8026
Description
steps
sbt 1.10.17
Use this build sbt
val Scala210 = "2.10.7"
val Scala212 = "2.12.20"
val SbtVersion_0 = "0.13.17"
val SbtVersion_1 = "1.0.0"
lazy val root = (project in file("."))
.enablePlugins(SbtPlugin)
.settings(
name := "test-sbt-2-cross-build",
scalaVersion := Scala210,
crossScalaVersions := Seq(
Scala210,
Scala212,
),
crossSbtVersions := Seq(
SbtVersion_0,
SbtVersion_1,
),
)Note that it has explicitly set the scala version via scalaVersion := Scala210
This is handy when you want to use the specific version in IDE when working on a cross-compiled version.
Now run sbt "show sbtUpdateClassifiers"
problem
Command sbt "show sbtUpdateClassifiers" fails with error
Error downloading org.scala-sbt:scripted-plugin_2.12:0.13.17
Full stack trace:
error] sbt.librarymanagement.ResolveException: Error downloading org.scala-sbt:scripted-plugin_2.12:0.13.17
[error] Not found
[error] not found: /Users/dmitrii.naumenko/.ivy2/local/org.scala-sbt/scripted-plugin_2.12/0.13.17/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/org/scala-sbt/scripted-plugin_2.12/0.13.17/scripted-plugin_2.12-0.13.17.pom
[error] not found: https://repo.scala-sbt.org/scalasbt/maven-releases/org/scala-sbt/scripted-plugin_2.12/0.13.17/scripted-plugin_2.12-0.13.17.pom
[error] not found: https://repo.scala-sbt.org/scalasbt/maven-snapshots/org/scala-sbt/scripted-plugin_2.12/0.13.17/scripted-plugin_2.12-0.13.17.pom
[error] not found: https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/scripted-plugin_2.12/0.13.17/ivys/ivy.xml
[error] not found: https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.scala-sbt/scripted-plugin_2.12/0.13.17/ivys/ivy.xml
[error] not found: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-sbt/scripted-plugin_2.12/0.13.17/ivys/ivy.xml
[error] not found: https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/scripted-plugin_2.12/0.13.17/ivys/ivy.xml
[error] not found: /Users/dmitrii.naumenko/Library/Application Support/JetBrains/IntelliJIdea2024.3/plugins/Scala/repo/org/scala-sbt/scripted-plugin_2.12/0.13.17/scripted-plugin_2.12-0.13.17.pom
[error] at lmcoursier.CoursierDependencyResolution.unresolvedWarningOrThrow(CoursierDependencyResolution.scala:347)
[error] at lmcoursier.CoursierDependencyResolution.$anonfun$update$39(CoursierDependencyResolution.scala:316)
[error] at scala.util.Either$LeftProjection.map(Either.scala:573)
[error] at lmcoursier.CoursierDependencyResolution.update(CoursierDependencyResolution.scala:316)
[error] at sbt.librarymanagement.DependencyResolution.update(DependencyResolution.scala:60)
[error] at sbt.internal.LibraryManagement$.transitiveScratch(LibraryManagement.scala:201)
[error] at sbt.Classpaths$.$anonfun$sbtClassifiersTasks$16(Defaults.scala:3668)
[error] at sbt.internal.LibraryManagement$$anon$2.call(LibraryManagement.scala:367)
[error] at sbt.internal.LibraryManagement$$anon$2.call(LibraryManagement.scala:359)
[error] at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:113)
[error] at xsbt.boot.Locks$GlobalLock.withChannelRetries$1(Locks.scala:91)
[error] at xsbt.boot.Locks$GlobalLock.$anonfun$withFileLock$1(Locks.scala:119)
[error] at xsbt.boot.Using$.withResource(Using.scala:12)
[error] at xsbt.boot.Using$.apply(Using.scala:9)
[error] at xsbt.boot.Locks$GlobalLock.withFileLock(Locks.scala:119)
[error] at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:71)
[error] at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:59)
[error] at xsbt.boot.Locks$.apply0(Locks.scala:47)
[error] at xsbt.boot.Locks$.apply(Locks.scala:36)
[error] at sbt.internal.LibraryManagement$.withExcludes(LibraryManagement.scala:359)
[error] at sbt.Classpaths$.withExcludes(Defaults.scala:3795)
[error] at sbt.Classpaths$.$anonfun$sbtClassifiersTasks$13(Defaults.scala:3655)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error] at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error] at sbt.Execute.work(Execute.scala:292)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[error] at java.base/java.lang.Thread.run(Thread.java:840)
[error] (updateSbtClassifiers) sbt.librarymanagement.ResolveException: Error downloading org.scala-sbt:scripted-plugin_2.12:0.13.17
[error] Not found
[error] not found: /Users/dmitrii.naumenko/.ivy2/local/org.scala-sbt/scripted-plugin_2.12/0.13.17/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/org/scala-sbt/scripted-plugin_2.12/0.13.17/scripted-plugin_2.12-0.13.17.pom
[error] not found: https://repo.scala-sbt.org/scalasbt/maven-releases/org/scala-sbt/scripted-plugin_2.12/0.13.17/scripted-plugin_2.12-0.13.17.pom
[error] not found: https://repo.scala-sbt.org/scalasbt/maven-snapshots/org/scala-sbt/scripted-plugin_2.12/0.13.17/scripted-plugin_2.12-0.13.17.pom
[error] not found: https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/scripted-plugin_2.12/0.13.17/ivys/ivy.xml
[error] not found: https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.scala-sbt/scripted-plugin_2.12/0.13.17/ivys/ivy.xml
[error] not found: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-sbt/scripted-plugin_2.12/0.13.17/ivys/ivy.xml
[error] not found: https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/scripted-plugin_2.12/0.13.17/ivys/ivy.xml
[error] not found: /Users/dmitrii.naumenko/Library/Application Support/JetBrains/IntelliJIdea2024.3/plugins/Scala/repo/org/scala-sbt/scripted-plugin_2.12/0.13.17/scripted-plugin_2.12-0.13.17.pom
expectation
It doesn't fail.
notes
In practice you will most likely notice the issue when downloading sbt sources for IDE.
If you try to load the project in IntelliJ with selected Settings | Build, Execution, Deployment | Build Tools | sbt | Download sbt sources it will fail.
Interestingly, if you move all the settings into a subproject, the project load in IntelliJ will succeed.
This is because IntelliJ only invokes udpateSbtClassifiers on the root.
...
lazy val root = (project in file(".")).aggregate(subProject)
lazy val subProject = (project in file("subProject"))
.enablePlugins(SbtPlugin)
.settings(
name := "subProject",
scalaVersion := Scala210,
...
)