Take this snippet from a Gradle build for instance:
repository {
repoKey = 'libs-snapshot-local'
username = 'whatever'
password = 'whatever123'
}
In the past, I've configured Maven (some setting under ~/.m2
) to simply pass username/password along. If at all humanly possible I'd like to avoid putting my login credentials for our Artifactory server inside a buildscript. Is there a more secure workaround?
you can put a gradle.properties
file into your ~/.gradle/ folder.
In this file you can put your credentials:
artifactoryUserName = whatever
artifactoryUserPassword = whatever123
now you can reference these properties in your build script:
repository {
repoKey = 'libs-snapshot-local'
username = project.hasProperty('artifactoryUserName') ? artifactoryUserName : ''
password = project.hasProperty('artifactoryUserPassword') ? artifactoryUserPassword : ''
}