多个目标的Sbt组装

时间:2018-10-26 12:52:01

标签: scala sbt

我需要使用sbt组装为多个版本的scala创建胖子。

当我定位单个版本时,我写simple.sbt

scalaVersion := "2.11.12"

然后将胖子罐输出到target/scala-2.11/Kernalytics-assembly-1.0.jar。现在,我还要针对Scala 2.12。我可以编辑sbt文件来更改scalaVersion,但是当我调用sbt assembly时,我希望在一系列Scala版本上实现组装过程自动化。

如果我使用crossScalaVersions

name := "Kernalytics"

version := "1.0"

crossScalaVersions := Seq("2.11.12", "2.12.4")

libraryDependencies  ++= Seq(
  "org.scalanlp" %% "breeze" % "0.13.2",
  "org.scalanlp" %% "breeze-natives" % "0.13.2",
  "org.scalanlp" %% "breeze-viz" % "0.13.2"
)

libraryDependencies += "commons-io" % "commons-io" % "2.6"

resolvers += "Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/"

libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.4"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test"

唯一的输出是target/scala-2.12/Kernalytics-assembly-1.0.jar

1 个答案:

答案 0 :(得分:0)

如果您使用crossScalaVersions,则我想为所有版本进行构建时都需要在命令前加上'+'。

来自Cross-Building a Project

  

要针对crossScalaVersions中列出的所有版本进行构建,请在操作前面加上+