如何将JOOQ构建和配置从sbt 0.3.16迁移到sbt 1.2.8
JOOQ在0.3.16中的构建定义如下。
val generateJOOQ = taskKey[Seq[File]]("Generate JooQ classes")
val generateJOOQTask = (baseDirectory, dependencyClasspath in Compile, runner in Compile, streams) map { (base, cp, r, s) =>
toError (r.run(
"org.jooq.util.GenerationTool",
cp.files,
Array("conf/openDoor.xml"),
s.log))
((base / "app" / "jooqSteps") ** "*.scala").get
}
generateJOOQ <<= generateJOOQTask
和运行sbt(1.2.8)时的结果:
build.sbt:70: error: value map is not a member of (sbt.SettingKey[java.io.File], sbt.TaskKey[sbt.Keys.Classpath], sbt.TaskKey[sbt.ScalaRun], sbt.TaskKey[sbt.Keys
.TaskStreams])
val generateJOOQTask = (baseDirectory, dependencyClasspath in Compile, runner in Compile, streams) map { (base, cp, r, s) =>
^
C:\workPlay\anchor\build.sbt:71: error: not found: value toError
toError (r.run(
^
[error] sbt.compiler.EvalException: Type error in expression
谢谢您的帮助
根据migrating from tuple enrichments指南和dropped deprecations release notes我们可以迁移generateJOOQTask
如下
val generateJOOQ = taskKey[Seq[File]]("Generate JooQ classes")
generateJOOQ := {
val base = baseDirectory.value
val cp = (dependencyClasspath in Compile).value
val r = (runner in Compile).value
val s = streams.value
r.run(
"org.jooq.util.GenerationTool",
cp.files,
Array("conf/openDoor.xml"),
s.log
).failed foreach (sys error _.getMessage)
((base / "app" / "jooqSteps") ** "*.scala").get
}