]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-21476 Fix public repository
authorJacek Poreda <jacek.poreda@sonarsource.com>
Mon, 29 Jan 2024 16:20:11 +0000 (17:20 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 30 Jan 2024 15:02:02 +0000 (15:02 +0000)
build.gradle
settings.gradle

index 431cb94879948e677a5a97378968b69111a9d171..23d4fd0fa2fc2747be746b7c8116d5a91ec0fa2d 100644 (file)
@@ -73,21 +73,28 @@ allprojects {
       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) {
index 1c1fa09fb5e8ca172e1fca0f33c549de83129523..99c930014dae98177c0ef0728001d9a999c7706e 100644 (file)
@@ -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/'
       }
     }
   }