Open charlesritchea opened 4 years ago
How Do I Load .env in gradle?
@liudongcxw in a task:
doFirst() {
def props = new Properties()
file(".env").withInputStream { props.load(it) }
props.each { String key, String val ->
System.setProperty(key, val)
environment key, val
}
}
Still relevant?
I was using EnvFile experimental features when running tests with Gradle Test Runner, and just like the description says, it broke at anytime :) I know I need to just load the .env file in gradle and problem solved, but wanted to let you know.