Reputation: 3958
My main Gradle script:
buildscript {scriptHandler->
apply from: "......./repositories.gradle", to: scriptHandler
}
loads repositories.gradle script:
repositories{
maven {
url = "myURL"
credentials {
username repositoryReadUsername
password repositoryReadPassword
}
}
}
Values repositoryReadUsername, repositoryReadPassword are defined in gradle.properties file.
I am getting error:
A problem occurred evaluating script.
Could not get unknown property 'repositoryReadUsername' for Credentials [username: null] of type org.gradle.api.internal.artifacts.repositories.DefaultPasswordCredentials_Decorated.
Upvotes: 4
Views: 746
Reputation: 28136
It seems to be not possible to use this properties within applied buildscript. Here is mostly the same question and the answer is:
Script plugins aren't currently affected by the buildscript section of the build scripts they get applied to. (Actually, it's questionable whether subproject build scripts should be affected by the buildscript sections of parent build scripts, even though that's the way it currently is.) What you can do is to move the reusable parts of the buildscript section into its own script plugin
So it seems, that you have to declare your repository out of scriptplugins or provide credentials without getting them from properties file.
Upvotes: 1