sbt升级到0.13.13后,在通用错误中的sbt映射

时间:2017-01-05 21:56:56

标签: sbt sbt-native-packager

mappings in Universal <++= (packageBin in Compile, sourceDirectory) map { (_, src) =>
  val confFiles = (src / "main" / "resources") ** "*.conf"
  confFiles.get.map(file => file -> ("conf/" + file.name))
},

正常但生成编译器警告&lt; ++ =已被弃用。将运算符更改为++ =生成编译器错误

  

错误:Append.Values没有隐含[Seq [(java.io.File,String)],sbt.Def.Initialize [sbt.Task [Seq [(java.io.File,String)]]]]发现,     所以sbt.Def.Initialize [sbt.Task [Seq [(java.io.File,String)]]]不能附加到Seq [(java.io.File,String)]       Universal ++ = 中的映射(编译中的packageBin,sourceDirectory)map {(_,src)=&gt;

2 个答案:

答案 0 :(得分:0)

这个操作员非常困惑。尝试一个功能相同的更简单的:=

mappings.in(Universal) := {
  // Dependency on packageBin (part of your previous definition).
  packageBin.in(Compile).value
  // Create the new mappings.
  val confFiles = (sourceDirectory.value / "main" / "resources") ** "*.conf"
  val newMappings = confFiles.get.map(file => file -> ("conf/" + file.name))
  // Append them manually to the previous value.
  mappings.in(Universal).value ++ newMappings
}

答案 1 :(得分:0)

以下是我如何解决它

mappings in Universal ++= { (packageBin in Compile, sourceDirectory) map { (_, src) =>
val confFiles = (src / "main" / "resources") ** "*.conf"
confFiles.get.map(file => file -> ("conf/" + file.name))
} 
}.value,

更好的是

mappings in Universal ++= {
val src = sourceDirectory.value
val confFiles = (src / "main" / "resources") ** "*.conf"
confFiles.get.map(file => file -> ("conf/" + file.name))
}