I would like to move company-specific configuration out of my ~/.gradle/gradle.properties and into an init script, ~/.gradle/company.init.gradle. Unfortunately, I can't figure out how to defien global Gradle properties in a init script in the same way that I would do so in a gradle.properties file.
My ~/.gradle/gradle.properties currently has:
org.gradle.daemon=true
org.gradle.caching=true
com.company.artifactory.username=drew.stephens@company.com
com.company.artifactory.apiKey=<api_key>
com.company.artifactory.contextUrl=https://company.jfrog.io/company
And I would like to move those Artifactory values to a company-specific init script, ~/.gradle/company.init.gradle (mainly because I commit my gradle.properties to my home directory repo):
gradle.allprojects {
com.company.artifactory.username=drew.stephens@company.com
com.company.artifactory.apiKey=<api_key>
com.company.artifactory.contextUrl=https://company.jfrog.io/company
}
But neither of those methods makes the property accessible from my buildscript:
task('foobar') {
// Outputs "null"
println(project.properties['com.company.artifactory.username'])
}