我有一个项目,包含一些子项目和许多依赖项,一个子项目将拥有大多数开发(app)并生成完整的jar需要时间。所以我想将胖子一代分成两个罐子:
我希望创建一个deps项目,如:
lazy val deps = (project in file("deps"))
.settings(
libraryDependencies ++= commonDependencies,
assemblyJarName in assembly := "deps.jar",
assemblyMergeStrategy in assembly := {
case m if m.toLowerCase.endsWith("manifest.mf") => MergeStrategy.discard
case m if m.toLowerCase.matches("meta-inf.*\\.sf$") => MergeStrategy.discard
case m if m.toLowerCase.startsWith("meta-inf/services/") => MergeStrategy.filterDistinctLines
case m if m.toLowerCase.endsWith(".dct") => MergeStrategy.first
case "reference.conf" => MergeStrategy.concat
case _ => MergeStrategy.first
}
).dependsOn(
measurement,
streaming,
domain
)
和我的应用项目如:
lazy val app = (project in file("my-app"))
.settings(clientEventSettings)
.settings(noPublishSettings)
.settings(
assemblyJarName in assembly := "my-app.jar",
assemblyMergeStrategy in assembly := {
case m if m.toLowerCase.endsWith("manifest.mf") => MergeStrategy.discard
case m if m.toLowerCase.matches("meta-inf.*\\.sf$") => MergeStrategy.discard
case m if m.toLowerCase.startsWith("meta-inf/services/") => MergeStrategy.filterDistinctLines
case m if m.toLowerCase.endsWith(".dct") => MergeStrategy.first
case "reference.conf" => MergeStrategy.concat
case _ => MergeStrategy.first
})
.dependsOn( //<- but do not package??
measurement,
streaming,
messagingDomain,
messagingKafkaToolkit,
domain,
analyticsWebtrekk,
commons
)
编译式my-app项目依赖于其他子项目(deps),但它应该是范围provided
,因为我不希望它由sbt-assembly打包。
我将尝试使用libraryDependencies,但我认为这意味着克隆commonDependencies,所有这些都使用范围provided
。
答案 0 :(得分:0)
sbt-assembly的readme提供了答案:
在此部分:Splitting your project and deps JARs
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false, includeDependency = false)