@@ -581,13 +581,16 @@ void withMavenWorkspace(Map args, Closure body) {
581581void mvn (String args ) {
582582 def develocityMainCredentialsId = helper. configuration. file?. develocity?. credentials?. main
583583 def develocityPrCredentialsId = helper. configuration. file?. develocity?. credentials?. pr
584+ def develocityBaseUrl = helper. configuration. file?. develocity?. url
584585 if ( ! helper. scmSource. pullRequest && develocityMainCredentialsId ) {
585586 // Not a PR: we can pass credentials to the build, allowing it to populate the build cache
586587 // and to publish build scans directly.
587- withCredentials([string(credentialsId : develocityMainCredentialsId,
588- variable : ' DEVELOCITY_ACCESS_KEY' )]) {
589- withGradle { // withDevelocity, actually: https://plugins.jenkins.io/gradle/#plugin-content-capturing-build-scans-from-jenkins-pipeline
590- sh " mvn $args "
588+ withEnv([" DEVELOCITY_BASE_URL=${ develocityBaseUrl} " ]) {
589+ withCredentials([string(credentialsId : develocityMainCredentialsId,
590+ variable : ' DEVELOCITY_ACCESS_KEY' )]) {
591+ withGradle { // withDevelocity, actually: https://plugins.jenkins.io/gradle/#plugin-content-capturing-build-scans-from-jenkins-pipeline
592+ sh " mvn $args "
593+ }
591594 }
592595 }
593596 }
@@ -597,10 +600,12 @@ void mvn(String args) {
597600 tryFinally({
598601 sh " mvn $args "
599602 }, { // Finally
600- withCredentials([string(credentialsId : develocityPrCredentialsId,
601- variable : ' DEVELOCITY_ACCESS_KEY' )]) {
602- withGradle { // withDevelocity, actually: https://plugins.jenkins.io/gradle/#plugin-content-capturing-build-scans-from-jenkins-pipeline
603- sh ' mvn develocity:build-scan-publish-previous || true'
603+ withEnv([" DEVELOCITY_BASE_URL=${ develocityBaseUrl} " ]) {
604+ withCredentials([string(credentialsId : develocityPrCredentialsId,
605+ variable : ' DEVELOCITY_ACCESS_KEY' )]) {
606+ withGradle { // withDevelocity, actually: https://plugins.jenkins.io/gradle/#plugin-content-capturing-build-scans-from-jenkins-pipeline
607+ sh ' mvn develocity:build-scan-publish-previous || true'
608+ }
604609 }
605610 }
606611 })
0 commit comments