Browse Source

SONAR-21476 Fix public repository

tags/10.4.0.87286
Jacek Poreda 2 months ago
parent
commit
8f24b6c18f
2 changed files with 33 additions and 24 deletions
  1. 20
    17
      build.gradle
  2. 13
    7
      settings.gradle

+ 20
- 17
build.gradle View 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) {

+ 13
- 7
settings.gradle View 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/'
}
}
}

Loading…
Cancel
Save