How to setup Gradle publish task user credentials with GitLab CI secret variables? I am using gradle maven publish plugin, and here is snippet from build.gradle
You don't need env. prefinx in your .gitlab-ci.yml. You don't need to re-export the variables as well.
If you have defined a variables named MAVEN_REPO_USER and MAVEN_REPO_PASS in Gitlab CI/CD settings for the project, you can just use them in Gradle script:
repositories {
maven {
credentials {
username System.getenv("MAVEN_REPO_USER")
password System.getenv("MAVEN_REPO_PASS")
}
url "…"
}
}