sbt-assembly:如何排除 src/main/resources 中的配置文件 [英] sbt-assembly: How do I exclude the configuration files in src/main/resources
问题描述
我正在使用来自 https://github.com/sbt/sbt-assembly 的 sbtassembly打包我的项目.
I am using sbtassembly from https://github.com/sbt/sbt-assembly to package my project.
我想知道有没有办法排除资源文件?
I'm wondering is there anyway to exclude the resource files?
推荐答案
您可以通过自定义 mergeStrategy
来指定要排除的文件(和路径):https://github.com/sbt/sbt-assembly# exclude-specific-files
You can specify files (and paths) to exclude by customizing the mergeStrategy
:
https://github.com/sbt/sbt-assembly#excluding-specific-files
因此要丢弃特定文件,您可以执行以下操作:
So for discarding specific file you can do something like this:
// 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
Here's the documentaion for all available strategies: https://github.com/sbt/sbt-assembly#merge-strategy
这篇关于sbt-assembly:如何排除 src/main/resources 中的配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!