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) {
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/'
}
}
}