Include file from build directory inside jar

Viewed 57

I want to include a file from my build/resources folder inside the jar that I am creating.

I have a directory structure like this:

project/
├─ build/
│  ├─ resources/
│  │  ├─ config.txt
├─ src/...
├─ build.gradle

And I build the jar using this Gradle task:

task fatJar(type: Jar) {
  from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
  with jar
}

How can I include my config file inside the jar while also keeping the current "fat" contents?

I believe moving the config from build/resources to main/resources would work but if there are alternate solutions I am open to them.

0 Answers
Related