Skip to content

Commit 3e0dce5

Browse files
committed
Update apache archive mirror url for faster artifact resolution (elastic#2460)
* Update apache archive mirror url for faster artifact resolution * Use mirror in addition to existing archive repo (cherry picked from commit d9dced4)
1 parent 328841c commit 3e0dce5

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

buildSrc/src/main/groovy/org/elasticsearch/hadoop/gradle/fixture/hadoop/HadoopFixturePlugin.groovy

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ import org.gradle.api.publish.ivy.IvyArtifact
3232

3333
class HadoopFixturePlugin implements Plugin<Project> {
3434

35-
private static final String APACHE_MIRROR = "https://archive.apache.org/dist/"
35+
private static final String APACHE_MIRROR_1 = "https://dlcdn.apache.org/"
36+
private static final String APACHE_MIRROR_2 = "https://archive.apache.org/dist/"
3637

3738
static class HadoopFixturePluginExtension {
3839
private NamedDomainObjectContainer<HadoopClusterConfiguration> clusters
@@ -70,18 +71,20 @@ class HadoopFixturePlugin implements Plugin<Project> {
7071

7172
private static configureApacheMirrorRepository(Project project) {
7273
RepositoryHandler repositoryHandler = project.getRepositories()
73-
repositoryHandler.add(repositoryHandler.ivy({IvyArtifactRepository ivyArtifactRepository ->
74-
ivyArtifactRepository.setUrl(APACHE_MIRROR)
75-
ivyArtifactRepository.patternLayout({IvyPatternRepositoryLayout ivyPatternRepositoryLayout ->
76-
// We use this pattern normally and break the regular tradition of a strictly numerical version
77-
// because Hive does not provide a reasonable artifact name that makes a more robust pattern
78-
// reasonable (it has a very unorthodox layout)
79-
ivyPatternRepositoryLayout.artifact("[organization]/[module]/[revision].[ext]")
80-
ivyPatternRepositoryLayout.setM2compatible(true)
81-
})
82-
ivyArtifactRepository.metadataSources({IvyArtifactRepository.MetadataSources metadataSources ->
83-
metadataSources.artifact()
84-
})
85-
}))
74+
[APACHE_MIRROR_1, APACHE_MIRROR_2].each { APACHE_MIRROR ->
75+
repositoryHandler.add(repositoryHandler.ivy({IvyArtifactRepository ivyArtifactRepository ->
76+
ivyArtifactRepository.setUrl(APACHE_MIRROR)
77+
ivyArtifactRepository.patternLayout({IvyPatternRepositoryLayout ivyPatternRepositoryLayout ->
78+
// We use this pattern normally and break the regular tradition of a strictly numerical version
79+
// because Hive does not provide a reasonable artifact name that makes a more robust pattern
80+
// reasonable (it has a very unorthodox layout)
81+
ivyPatternRepositoryLayout.artifact("[organization]/[module]/[revision].[ext]")
82+
ivyPatternRepositoryLayout.setM2compatible(true)
83+
})
84+
ivyArtifactRepository.metadataSources({IvyArtifactRepository.MetadataSources metadataSources ->
85+
metadataSources.artifact()
86+
})
87+
}))
88+
}
8689
}
8790
}

0 commit comments

Comments
 (0)