Search code examples
scalasbt

warning that sbt shell syntax is deprecated


[warn] sbt 0.13 shell syntax is deprecated; use slash syntax instead: Test / package

I am getting the warning above, but I am baffled because I think I am using slash syntax. My build.sbt file is copied below for anyone who can tell me where I am using 0.13 shell syntax. Also, if anything else looks funny about my build.sbt file, please don't hesitate to tell me. Thanks.

name := "trajspec"
version := "0.999"
scalaVersion := "3.3.0"
organization := "gov.nasa.arc"
outputStrategy := Some(StdoutOutput)
run/connectInput := true
crossPaths := false
fork := true

//run / javaOptions += "-Xprof"

Test / unmanagedSourceDirectories += baseDirectory.value/"src"/"plot"
Test / unmanagedSourceDirectories += baseDirectory.value/"src"/"sim"
Test / unmanagedSourceDirectories += baseDirectory.value/"src"/"scalar"

Compile / scalaSource := baseDirectory.value/"src"/"main"
Compile / javaSource  := baseDirectory.value/"src"/"main"
Compile / scalaSource := baseDirectory.value/"src"/"scalar"
Test / scalaSource    := baseDirectory.value/"src"/"test"
Test / scalaSource    := baseDirectory.value/"src"/"plot"
Test / scalaSource    := baseDirectory.value/"src"/"sim"
Test / javaSource     := baseDirectory.value/"src"/"test"

libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "2.0.0"
libraryDependencies +=
  "org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.3"

scalacOptions += "-deprecation"
//scalacOptions += "-Xcheckinit"
scalacOptions += "-feature"

Solution

  • As @Mateusz Kubuszok said in the comments.

    The command you are running

    sbt test:package
    

    is using the old and deprecated syntax.

    Just changing it to

    Test / package
    

    will stop showing the warning


    You have a doc that shows how to Migrate to slash syntax in sbt 1.x

    Migrating to slash syntax

    In sbt 0.13 keys were scoped with 2 different syntaxes: one for sbt’s shell and one for in code.

    • sbt 0.13 shell: <project-id>/config:intask::key
    • sbt 0.13 code: key in (<project-id>, Config, intask)

    Starting sbt 1.1.0, the syntax for scoping keys has been unified for both the shell and the build definitions to the slash syntax as follows:

    • <project-id> / Config / intask / key