警告:sbt shell 语法已被弃用。

huangapple go评论104阅读模式
英文:

warning that sbt shell syntax is deprecated

问题

[警告] sbt 0.13 shell 语法已弃用;请改用斜杠语法:Test / package

我收到了上面的警告,但我感到困惑,因为我认为我正在使用斜杠语法。我的 build.sbt 文件如下,如果有人能告诉我我在哪里使用了 0.13 shell 语法,请告诉我。另外,如果我的 build.sbt 文件还有其他令人困惑的地方,请不要犹豫告诉我。谢谢。

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"
英文:

[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"

答案1

得分: 1

As @Mateusz Kubuszok 在评论中所说。

您正在运行的命令

sbt test:package

使用的是旧的且已弃用的语法。

只需将其更改为

Test / package

将停止显示警告


您有一份文档,显示了如何Migrate to slash syntax在 sbt 1.x 中

> #### Migrating to slash syntax
>
> 在 sbt 0.13 中,键使用了两种不同的语法进行范围限定:一种用于 sbt 的 shell,一种用于代码中。
>
> - sbt 0.13 shell: <project-id>/config:intask::key
> - sbt 0.13 code: key in (<project-id>, Config, intask)
>
> 从 sbt 1.1.0 开始,用于范围限定键的语法已统一为斜杠语法,如下所示:
>
> - <project-id> / Config / intask / key

英文:

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

huangapple
  • 本文由 发表于 2023年8月5日 04:17:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76838903.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定