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

index bda07b893b5bbeeb3dabfbbec6e549bf045773cc..aa5962d99e0c1cd249c5bc01d289feffb994a7d5 100644 (file)
@@ -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) {
index 8d4101493af9ea5b611e1e622feb51df0209435f..284b3f241d2f9636cdf470da39c352d42bb5d2f8 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/'
       }
     }
   }