当存在这一行时,Sbt会产生错误:
fork in run := true
在此build.scala文件中
周围的build.scala内容
lazy val scalafxDemos = Project(
id = "scalafx-demos",
base = file("scalafx-demos"),
settings = scalafxSettings ++ Seq(
libraryDependencies ++= Seq(
scalatest % "test",
junit % "test"),
unmanagedListing,
description := "The ScalaFX demonstrations",
fork in run := true,
fork in Test := true,
parallelExecution in Test := false,
// print junit-style XML for CI
testOptions in Test <+= (target in Test) map {
t => Tests.Argument(TestFrameworks.ScalaTest, "-u", "%s" format (t / "junitxmldir"))
},
产生错误:
[error] /Users/hanxue/Github/scalafx/project/build.scala:113: overloaded method value in with alternatives:
[error] (scope: sbt.Scope)sbt.SettingKey[Boolean] <and>
[error] (c: sbt.ConfigKey)sbt.SettingKey[Boolean] <and>
[error] (t: sbt.Scoped)sbt.SettingKey[Boolean] <and>
[error] (p: sbt.Reference)sbt.SettingKey[Boolean]
[error] cannot be applied to (run.type)
[error] fork in run := true,
[error] ^
[error] one error found
[error] (compile:compile) Compilation failed
我可以通过将行更改为fork := true
来避免错误,但这确实满足仅在run
和Test
中分叉的意图。如何解决这个问题而不强迫其他所有东西分叉?
答案 0 :(得分:1)
这可能意味着run
来自其他地方。您可以尝试使用明确的Keys.run
来查看是否属于这种情况。