How to add custom directory to Scala SBT project?

2020-02-14 17:08发布

问题:

We have conf directory in our project which is fine, but one of the new components requires its own config to be placed into config directory and we can't change that requirement. In my build.scala I added the line:

unmanagedResourceDirectories in Compile += baseDirectory.value / "config",

In SBT when I run $ inspect tree package-src I can see the config directory under compile:unmanagedResourceDirectories section which is under compile:packageSrc::mappings section.

Then I try to check the deployment package locally by running $ publishLocal. The target config directory is missing in the result .zip package.

What did I miss / do wrong?

回答1:

This is what I added to my Build.scala to finally solve the issue:

mappings in Universal ++= (baseDirectory.value / "config" * "*" get) map
  (x => x -> ("config/" + x.getName)),


标签: scala sbt