默认情况下在0.13.x中在子项目的上下文中执行“运行”

时间:2018-11-07 19:54:00

标签: sbt

我以前可以在build.sbt文件中使用以下命令,以允许我在run项目中执行root命令,但是run命令只能在我的migrations项目的上下文:

lazy val root = project.dependsOn(rest,migrations).settings(publish := { }).disablePlugins(RevolverPlugin, AssemblyPlugin)
lazy val rest = project.enablePlugins(BuildInfoPlugin)
lazy val migrations = project.dependsOn(rest).settings(mainClass in (Compile, run) := Some("com.myapp.Migrations"), fork in run := true).disablePlugins(RevolverPlugin)

run in Compile <<= (run in Compile in migrations)

然后我将像这样执行run

> run up

(ps up是要传递给com.myapp.Migrations的参数)

但是,当更新到sbt v0.13.17时,我现在收到警告:

See http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html
run in Compile <<= (run in Compile in migrations)

在所引用的url中,似乎表明我可以将<<=替换为:=,但是如果我这样更改的话:

run in Compile := (run in Compile in migrations)

然后我在sbt中键入run up,出现错误:

[error] Expected ID character
[error] Not a valid command: run (similar: plugin, new)
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Expected '::'
[error] Expected end of input.
[error] run up
[error]    ^

有人知道我如何更新上述行以使其与0.13.x兼容并仍能按预期工作?

1 个答案:

答案 0 :(得分:1)

请参见https://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html#Migrating+with

  

使用InputKey迁移

     

使用InputKey代替:

     
ctrl-c
     

迁移时,您不得使用.value而是.evaluated:

run <<= docsRunSetting

在您的情况下,请尝试run := docsRunSetting.evaluated