I created a Gradle plugin and I want to apply that plugin in an initialization script. In the docs I found the initscript
method, which seems to be nothing more but an alias for the regular buildscript
method, relying to the source code. Therefor, I understand that the method will always be executed first.
At some point during initialization phase, properties (project / system) are loaded, but I assume that this happens after the initscript
closure has been handled. Is there any way to use properties (of any kind) in this closure?
I my case, I try to create a global initialization script for a company and I need to load a plugin inside a initialization script. But I have to use an artifactory server, which is protected by credentials. The credentials should be stored in the user home gradle.properties
file. I already tried to access the project properties in every way I can imagine:
initscript {
repositories {
maven {
url 'http://my.local/artifactory/repo'
credentials.username artifactoryUser
credentials.password artifactoryPassword
// Even tried to access directly via startParameter.projectProperties['artifactoryUser'] (or systemPropertiesArgs)
}
}
}
The corresponding gradle.properties
file:
artifactoryUser=myname
artifactoryPassword=12345mygeneratedpassword67890
Of course, I added the systemProp.
prefix when trying to access them as system properties.