Skip to content

Instantly share code, notes, and snippets.

@xnickmx
Last active January 3, 2016 22:19
Show Gist options
  • Save xnickmx/8528048 to your computer and use it in GitHub Desktop.
Save xnickmx/8528048 to your computer and use it in GitHub Desktop.
How to store credentials for multiple Maven repos in a properties file.
final properties = new Properties()
properties.load(new FileInputStream(System.getProperty("user.home") + "/.grails/maven.properties"))
final mavenUsername = properties.getProperty("user")
final mavenPassword = properties.getProperty("password")
mavenRepo ("http://repo.mycompany.com:8081/artifactory/libs-release-local") {
auth([
username: mavenUsername,
password: mavenPassword
])
}
mavenRepo ("http://repo.mycompany.com:8081/artifactory/remote-repos") {
auth([
username: mavenUsername,
password: mavenPassword
])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment