我的主scala项目的结构如下。它包含两个子项目。
├── build.sbt
├── project1
│ ├── src
│ ├── build.sbt
│ ├── conf
├── project2
│ ├── src
│ ├── build.sbt
│ ├── conf
├── target
我的要求是在主项目的build.sbt中有3个目标。我已经创建了胖jar,所以我使用程序集插件来构建项目。
Target1: this builds both project1 and project2
Target2: this builds project1
Target3: this builds project3
我的主要项目的build.sbt如下所示:
lazy val commonSettings = Seq(
version := "1.0",
scalaVersion := "2.10.4")
lazy val root = (project in file(".")).aggregate(jar1,jar2)
lazy val jar1 = project.in(file("project1"))
.settings(commonSettings: _*)
.settings(
name := "project1",
assemblyJarName in assembly := "project1.jar",
test in assembly := {},
libraryDependencies ++= Seq(...),
)
lazy val jar2 = project.in(file("project2"))
.settings(commonSettings: _*)
.settings(
name := "project2",
assemblyJarName in assembly := "project2.jar",
test in assembly := {},
libraryDependencies ++= Seq(...),
)
使用此build.sbt,当我使用sbt assembly
时,它充当target1
。我不确定如何创建target2(builds project1)
和target3(builds project2)
。
有任何建议如何实现这一目标?
由于
答案 0 :(得分:0)
启动sbt并不足以在sbt shell中发出命令
project project1
sbt assembly
这应该只构建project1(在project1 / target文件夹中)。