Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

scala

sbt

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?

like image 756
reikje Avatar asked Dec 10 '13 10:12

reikje


1 Answers

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

like image 164
4lex1v Avatar answered Oct 26 '22 15:10

4lex1v