I'm using the config var plugin for heroku (see https://devcenter.heroku.com/articles/config-vars).
It allows me to use a .env file which I do not push to source control to define the heroku environment.
So when I'm on heroku, I can access sensible information via System.properties.
In dev, I would like to read from this file so it would be best if it were on my classpath.
The .env file is at the root of my project so I cannot use something like this :
sourceSets {
main {
resources {
srcDirs = ['src/main/resources', '/']
}
}
}
What is the simplest way to include a single file into gradle resources ?
The earlier answers seemed more complicated than I was hoping for, so I asked on the gradle forums and got a reply from a Sterling Green who's one of the gradle core devs.
He suggested configuring processResources
directly
processResources {
from(".env")
}
He also mentioned that it might be a bad idea to include the project root as an input directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With