I want to replace build-dependent information in certain resource files (e.g. in src/main/resources). In Gradle, I can do this:
processResources {
// apply replacements in meta.cfg
from(sourceSets.main.resources.srcDirs) {
include "meta.cfg"
expand "version": project.version, "build": System.env.BUILD
}
// just copy everything else
from(sourceSets.main.resources.srcDirs) {
exclude "meta.cfg"
}
}
Using this, occurrences of ${version} and ${build} are replaced by their respective values known at build time.
In this question, sbt-buildinfo and sbt-editsource are suggested, but they only provide workarounds of the general problem "How do I inject build info in my code?" and do not solve this specific problem.
Is there a straightforward way to do this in sbt?