Anton Feoktistov
Anton Feoktistov

Reputation: 353

Remove scala-library.jar from Scala 3 project

I am trying to replicate one Java project in Scala and SBT. For some reason, copying Runtime / managedClasspath into target/libs folder also copies scala-library-2.13.15.jar beside scala3-library_3-3.6.3.jar.

lazy val copyDependencies = taskKey[Unit]("Copies all JAR dependencies to target/libs")
copyDependencies := {
  IO.createDirectory(libsDir.value)
  (Runtime / managedClasspath).value.foreach { jar =>
    val dest = libsDir.value / jar.data.getName
    IO.copyFile(jar.data, dest)
  }
}

My goal is to start the app as java -jar target/helidon-quickstart-se.jar. If delete Scala2 lib, there will be java.lang.ClassNotFoundException: scala.Predef$ error, however, I don't have any Scala2 code in project, only v3.

sbt dependencyTree doesn't show any dep to scala2. autoScalaLibrary := false and adding scala3 only to libraryDependencies also has no effect.

Upvotes: 0

Views: 46

Answers (0)

Related Questions