I'm trying to deploy a Gradle-built artifact to a Maven repo, and I need to specify credentials for that. This works fine for now:
uploadArchives {
repositories {
mavenDeployer {
repository(url: "http://.../nexus/content/repositories/snapshots/") {
authentication(userName: "admin", password: "admin123")
}
}
}
}
But I don't like having to store the credentials in source control. With Maven, I would define a server configuration, and assign credentials in my ~/.m2/settings.xml
. How do I do something similar with Gradle?
~/.gradle/gradle.properties:
mavenUser=admin
mavenPassword=admin123
build.gradle:
...
authentication(userName: mavenUser, password: mavenPassword)