为我的SBT Auto插件项目设置交叉编译

时间:2018-03-21 14:40:22

标签: scala sbt

我正在写一个SBT Auto Plugin。这是我的build.sbt文件

lazy val foo = (project in file(".")).settings(
   name := "foo",
   sbtPlugin := true,
   organization := "com.foo",
   crossScalaVersions = Seq("2.11.8", "2.12.4")
)

但我收到了错误

overloaded method value settings with alternatives:
  (ss: sbt.Def.SettingsDefinition*)sbt.Project <and>
  => Seq[sbt.Def.Setting[_]]
 cannot be applied to (sbt.Def.Setting[String], sbt.Def.Setting[Boolean], sbt.Def.Setting[String], crossScalaVersions: Seq[String])
lazy val foo = (project in file(".")).settings(
                                                         ^
[error] sbt.compiler.EvalException: Type error in expression
[error] sbt.compiler.EvalException: Type error in expression
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i

我的目标是,当我sbt publish时,我发布了两个jar文件。一个用于scala 2.11,另一个用于scala 2.12

1 个答案:

答案 0 :(得分:4)

您必须提供crossScalaVersions := Seq("2.11.8", "2.12.4")而不是crossScalaVersions = Seq("2.11.8", "2.12.4")

您可以在此处查看更多Cross-Building a Project