Skip to content

Commit f4a129e

Browse files
[NO-JIRA] Get repox authentication working for Sonar devs
1 parent 8cecd40 commit f4a129e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

build.gradle.kts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,19 @@ allprojects {
9595
mavenLocal()
9696
val repository = if (project.hasProperty("qa")) "sonarsource-qa" else "sonarsource"
9797
maven {
98-
credentials {
99-
username = System.getenv("ARTIFACTORY_PRIVATE_USERNAME")
100-
password = System.getenv("ARTIFACTORY_PRIVATE_PASSWORD")
101-
}
10298
url = uri("https://repox.jfrog.io/repox/${repository}")
99+
100+
// The environment variables ARTIFACTORY_PRIVATE_USERNAME and ARTIFACTORY_PRIVATE_PASSWORD are used in QA
101+
// On local box, please add artifactoryUsername and artifactoryPassword to ~/.gradle/gradle.properties
102+
val artifactoryUsername = System.getenv("ARTIFACTORY_PRIVATE_USERNAME") ?: project.findProperty("artifactoryUsername") ?: ""
103+
val artifactoryPassword = System.getenv("ARTIFACTORY_PRIVATE_PASSWORD") ?: project.findProperty("artifactoryPassword") ?: ""
104+
105+
if (artifactoryUsername is String && artifactoryUsername.isNotEmpty() && artifactoryPassword is String && artifactoryPassword.isNotEmpty()) {
106+
credentials {
107+
username = artifactoryUsername
108+
password = artifactoryPassword
109+
}
110+
}
103111
}
104112
}
105113
}

0 commit comments

Comments
 (0)