我正在使用来自https://github.com/sbt/sbt-assembly的sbtassembly来打包我的项目。
我想知道有什么方法可以排除资源文件吗?
发布于 2016-02-03 03:49:33
您可以通过自定义mergeStrategy:https://github.com/sbt/sbt-assembly#excluding-specific-files来指定要排除的文件(和路径
因此,对于丢弃特定的文件,您可以这样做:
// build.sbt
assemblyMergeStrategy in assembly := {
case PathList("about.html") => MergeStrategy.discard
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}以下是所有可用策略的文档:https://github.com/sbt/sbt-assembly#merge-strategy
发布于 2017-02-11 04:55:45
在sbt 0.13.13中使用Dani的方法时,配置文件仍然包含在我的jar中。不过,这是可行的:
excludeFilter in Compile := "myconfig.conf",在我的示例中,所有文件都具有相同的名称myconfig.conf,但是存在于src/main/resources/config下的一个树结构中。我试过了:
unmanagedResourceDirectories in Compile += { baseDirectory.value / "src/main/resources/config" },但是它从jar中删除了目录,留下了文件。
文档记录在这里:http://www.scala-sbt.org/0.13/docs/Howto-Customizing-Paths.html
https://stackoverflow.com/questions/35162016
复制相似问题