Hi, if you use nexusUser and nexusPassword in build.gradle like that, you can (ab)use environment variables to inject the credentials from Jenkins to Gradle as project properties (which you can access the same way as gradle properties).
https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties > If the environment variable name looks like > ORG_GRADLE_PROJECT_prop=somevalue, then Gradle will set a prop property on > your project object, with the value of somevalue. Note _prop is case-sensitive, i.e. it would be ORG_GRADLE_PROJECT_nexusUser, *not* _NEXUSUSER. https://plugins.jenkins.io/credentials-binding/ (should be installed by default) https://docs.cloudbees.com/docs/cloudbees-ci/latest/cloud-secure-guide/injecting-secrets (cloudbees is the company behind jenkins) BR On 21 January 2023 19:54:14 CET, 'Martin Schmude' via Jenkins Users <jenkinsci-users@googlegroups.com> wrote: >You should make use of the Jenkins credentials store. >https://www.jenkins.io/doc/book/using/using-credentials/ >Several kinds of secrets can be stored there. Type "User and password" >suits your needs. > >How to use that in your pipeline script: >https://www.jenkins.io/doc/pipeline/steps/credentials-binding/ > > >mats...@gmail.com schrieb am Freitag, 20. Januar 2023 um 21:37:38 UTC+1: > >> Hi, >> >> Here is my build.gradle: >> >> repositories { >> mavenLocal() >> mavenCentral() >> // nexus credentials (nexusUser and nexusPassword) are stored in >> ~/.gradle/gradle.properties >> maven { >> url "${nexusRepoUrl}/repository/maven-public/" >> credentials { >> username = nexusUser >> password = nexusPassword >> } >> } >> } >> >> How can I provide nexusUser and nexusPassword to the job (ideally >> globally)? >> >> Regards, Sunil >> >> > >-- >You received this message because you are subscribed to the Google Groups >"Jenkins Users" group. >To unsubscribe from this group and stop receiving emails from it, send an >email to jenkinsci-users+unsubscr...@googlegroups.com. >To view this discussion on the web visit >https://groups.google.com/d/msgid/jenkinsci-users/696d22d9-16ad-4a97-877a-ff9510a6be74n%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0E83DF9A-1454-429F-8DB5-DA47171F6A3B%40chsc.de.