aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacek Poreda <jacek.poreda@sonarsource.com>2024-01-29 17:05:59 +0100
committersonartech <sonartech@sonarsource.com>2024-01-30 15:02:03 +0000
commit8f24b6c18f3da5d2de1db3d637bc6eeb9e2542a2 (patch)
treefdd17492d3c5d379aded1d759f0a959a1c844c3e
parent31a7fec19c486405938f990f399fda918a91f595 (diff)
downloadsonarqube-8f24b6c18f3da5d2de1db3d637bc6eeb9e2542a2.tar.gz
sonarqube-8f24b6c18f3da5d2de1db3d637bc6eeb9e2542a2.zip
SONAR-21476 Fix public repository
-rw-r--r--build.gradle37
-rw-r--r--settings.gradle20
2 files changed, 33 insertions, 24 deletions
diff --git a/build.gradle b/build.gradle
index bda07b893b5..aa5962d99e0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -83,25 +83,28 @@ allprojects {
def artifactoryPassword = System.env.'ARTIFACTORY_PRIVATE_PASSWORD' ?: (project.hasProperty('artifactoryPassword') ? project.getProperty('artifactoryPassword') : '')
def artifactoryUrl = System.getenv('ARTIFACTORY_URL') ?: (project.hasProperty('artifactoryUrl') ? project.getProperty('artifactoryUrl') : '')
- if (artifactoryUrl == '') {
- throw new GradleException('Invalid artifactoryUrl')
- }
-
- maven {
- if (artifactoryPassword) {
- authentication {
- header(HttpHeaderAuthentication)
- }
- credentials(HttpHeaderCredentials) {
- name = "Authorization"
- value = "Bearer $artifactoryPassword"
- }
- } else {
- // Workaround for artifactory
- // https://www.jfrog.com/jira/browse/RTFACT-13797
- repository = 'public'
+ if (artifactoryPassword) {
+ if (artifactoryUrl == '') {
+ throw new GradleException('Invalid artifactoryUrl')
+ }
+ maven {
+ authentication {
+ header(HttpHeaderAuthentication)
+ }
+ credentials(HttpHeaderCredentials) {
+ name = "Authorization"
+ value = "Bearer $artifactoryPassword"
}
url "${artifactoryUrl}/${repository}"
+ }
+ } else {
+ mavenCentral()
+ maven {
+ url 'https://jitpack.io'
+ }
+ maven {
+ url 'https://maven.codelibs.org/'
+ }
}
ivy {
if (artifactoryUsername && artifactoryPassword) {
diff --git a/settings.gradle b/settings.gradle
index 8d4101493af..284b3f241d2 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,13 +1,19 @@
pluginManagement {
repositories {
+ def artifactoryPassword = System.env.'ARTIFACTORY_PRIVATE_PASSWORD'
+
maven {
- url 'https://repox.jfrog.io/repox/plugins.gradle.org/'
- authentication {
- header(HttpHeaderAuthentication)
- }
- credentials(HttpHeaderCredentials) {
- name = "Authorization"
- value = "Bearer $System.env.ARTIFACTORY_PRIVATE_PASSWORD"
+ if (artifactoryPassword) {
+ url 'https://repox.jfrog.io/repox/plugins.gradle.org/'
+ authentication {
+ header(HttpHeaderAuthentication)
+ }
+ credentials(HttpHeaderCredentials) {
+ name = "Authorization"
+ value = "Bearer $artifactoryPassword"
+ }
+ } else {
+ url 'https://plugins.gradle.org/m2/'
}
}
}