Re: [sbt] don't package some specific files

39 views
Skip to first unread message

Mark Harrah

unread,
May 1, 2013, 11:21:28 AM5/1/13
to simple-b...@googlegroups.com
On Fri, 26 Apr 2013 14:18:16 -0700 (PDT)
Pablo Fernandez <fernande...@gmail.com> wrote:

> I have some configuration on src/main/resources that's needed for the
> project to run. This works fine.
>
> Now I want them to be copied to /target when I do "sbt run" BUT I don't
> want them included in the jar when I "sbt package". So far I got this that
> doesn't work:
>
> val dontPutConfInJar = (excludeFilter in unmanagedResources) := "*.conf")
>
> That setting (when added to a project obviously) excludes them both from
> the "package" and the "run" goals. Other stuff I tried:
>
> val dontPutConfInJar = (excludeFilter in packageSrc) := "*.conf")
> //includes them anyway
>
> val dontPutConfInJar = (excludeFilter in (unmanagedResources, packageSrc)
> := "*.conf") // doesn't compile
>
> What should I do?

You can explicitly filter the `mappings in (Compile,packageSrc)` task. You probably want something like:

mappings in (Compile,packageSrc) ~= {
(ms: Seq[(File,String)]) =>
ms.filter(_._1.getName.endsWith(".conf"))
}

It does seem reasonable for excludeFilter to be able to affect packageSrc separately by scoping it to packageSrc. Please open an issue.

-Mark

> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-t...@googlegroups.com.
> To post to this group, send email to simple-b...@googlegroups.com.
> Visit this group at http://groups.google.com/group/simple-build-tool?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Reply all
Reply to author
Forward
0 new messages