reikje
reikje

Reputation: 3064

How to exclude resources during packaging with SBT but not during testing

I have a bunch of conf files in a project structure like this:

```

src / main / resources / live.conf
src / test / resources / test.conf

```

I want to excluded live.conf from the artifact that is build when I run sbt one-jar (using the one-jar plugin). I added this line which unfortunately also excludes test.conf when running sbt test:compile

excludeFilter in Runtime in unmanagedResources := "*.conf"

How can I exclude live.conf in the artifact jar but not for the tests?

Upvotes: 15

Views: 7629

Answers (1)

4lex1v
4lex1v

Reputation: 21547

This should help:

mappings in (Compile, packageBin) ~= { _.filter(!_._1.getName.endsWith(".conf")) }

packageBin is a task which produces your jar artifact and mappings denotes files wich are used for compilation and project packaging in Compile scope

Upvotes: 25

Related Questions