Skip to content

Commit 16a2c42

Browse files
authored
Provide names for all artifact repositories (#41857)
This commit adds a name for each Maven and Ivy repository used in the build.
1 parent 3eb8575 commit 16a2c42

File tree

20 files changed

+33
-7
lines changed

20 files changed

+33
-7
lines changed

.ci/init.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ if (System.env.ELASTIC_ARTIFACTORY_USERNAME == null || System.env.ELASTIC_ARTIFA
66
settings.pluginManagement {
77
repositories {
88
maven {
9+
name "artifactory-gradle-plugins"
910
url "https://artifactory.elstc.co/artifactory/gradle-plugins"
1011
credentials {
1112
username System.env.ELASTIC_ARTIFACTORY_USERNAME
@@ -21,6 +22,7 @@ if (System.env.ELASTIC_ARTIFACTORY_USERNAME == null || System.env.ELASTIC_ARTIFA
2122
buildscript {
2223
repositories {
2324
maven {
25+
name "artifactory-gradle-release"
2426
url "https://artifactory.elstc.co/artifactory/gradle-release/"
2527
credentials {
2628
username System.env.ELASTIC_ARTIFACTORY_USERNAME
@@ -31,6 +33,7 @@ if (System.env.ELASTIC_ARTIFACTORY_USERNAME == null || System.env.ELASTIC_ARTIFA
3133
}
3234
repositories {
3335
maven {
36+
name "artifactory-gradle-release"
3437
url "https://artifactory.elstc.co/artifactory/gradle-release/"
3538
credentials {
3639
username System.env.ELASTIC_ARTIFACTORY_USERNAME

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ subprojects {
8888
}
8989
repositories {
9090
maven {
91-
name = 'localTest'
91+
name = 'test'
9292
url = "${rootProject.buildDir}/local-test-repo"
9393
}
9494
}

buildSrc/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ if (project != rootProject) {
189189
task integTest(type: Test) {
190190
// integration test requires the local testing repo for example plugin builds
191191
dependsOn project.rootProject.allprojects.collect {
192-
it.tasks.matching { it.name == 'publishNebulaPublicationToLocalTestRepository'}
192+
it.tasks.matching { it.name == 'publishNebulaPublicationToTestRepository'}
193193
}
194194
dependsOn setupLocalDownloads
195195
exclude "**/*Tests.class"

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import org.gradle.api.artifacts.ModuleVersionIdentifier
3939
import org.gradle.api.artifacts.ProjectDependency
4040
import org.gradle.api.artifacts.ResolvedArtifact
4141
import org.gradle.api.artifacts.dsl.RepositoryHandler
42+
import org.gradle.api.artifacts.repositories.ArtifactRepository
4243
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
4344
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
4445
import org.gradle.api.credentials.HttpHeaderCredentials
@@ -585,11 +586,11 @@ class BuildPlugin implements Plugin<Project> {
585586
project.getRepositories().all { repository ->
586587
if (repository instanceof MavenArtifactRepository) {
587588
final MavenArtifactRepository maven = (MavenArtifactRepository) repository
588-
assertRepositoryURIUsesHttps(project, maven.getUrl())
589+
assertRepositoryURIUsesHttps(maven, project, maven.getUrl())
589590
repository.getArtifactUrls().each { uri -> assertRepositoryURIUsesHttps(project, uri) }
590591
} else if (repository instanceof IvyArtifactRepository) {
591592
final IvyArtifactRepository ivy = (IvyArtifactRepository) repository
592-
assertRepositoryURIUsesHttps(project, ivy.getUrl())
593+
assertRepositoryURIUsesHttps(ivy, project, ivy.getUrl())
593594
}
594595
}
595596
RepositoryHandler repos = project.repositories
@@ -601,6 +602,7 @@ class BuildPlugin implements Plugin<Project> {
601602
}
602603
repos.jcenter()
603604
repos.ivy {
605+
name "elasticsearch"
604606
url "https://artifacts.elastic.co/downloads"
605607
patternLayout {
606608
artifact "elasticsearch/[module]-[revision](-[classifier]).[ext]"
@@ -629,9 +631,9 @@ class BuildPlugin implements Plugin<Project> {
629631
}
630632
}
631633

632-
private static void assertRepositoryURIUsesHttps(final Project project, final URI uri) {
634+
private static void assertRepositoryURIUsesHttps(final ArtifactRepository repository, final Project project, final URI uri) {
633635
if (uri != null && uri.toURL().getProtocol().equals("http")) {
634-
throw new GradleException("repository on project with path [${project.path}] is using http for artifacts on [${uri.toURL()}]")
636+
throw new GradleException("repository [${repository.name}] on project with path [${project.path}] is using http for artifacts on [${uri.toURL()}]")
635637
}
636638
}
637639

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ class VagrantTestPlugin implements Plugin<Project> {
174174
which should work for 5.0.0+. This isn't a real ivy repository but gradle
175175
is fine with that */
176176
repos.ivy {
177+
name "elasticsearch"
177178
artifactPattern "https://artifacts.elastic.co/downloads/elasticsearch/[module]-[revision].[ext]"
178179
}
179180
}

buildSrc/src/test/java/org/elasticsearch/gradle/BuildExamplePluginsIT.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ private void adaptBuildScriptForTest() throws IOException {
9999
"buildscript {\n" +
100100
" repositories {\n" +
101101
" maven {\n" +
102+
" name = \"test\"\n" +
102103
" url = '" + getLocalTestRepoPath() + "'\n" +
103104
" }\n" +
104105
" }\n" +
@@ -117,12 +118,14 @@ private void adaptBuildScriptForTest() throws IOException {
117118
String luceneSnapshotRevision = System.getProperty("test.lucene-snapshot-revision");
118119
if (luceneSnapshotRepo != null) {
119120
luceneSnapshotRepo = " maven {\n" +
121+
" name \"lucene-snapshots\"\n" +
120122
" url \"https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/" + luceneSnapshotRevision + "\"\n" +
121123
" }\n";
122124
}
123125
writeBuildScript("\n" +
124126
"repositories {\n" +
125127
" maven {\n" +
128+
" name \"test\"\n" +
126129
" url \"" + getLocalTestRepoPath() + "\"\n" +
127130
" }\n" +
128131
" flatDir {\n" +

buildSrc/src/testKit/elasticsearch.build/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ repositories {
1616
jcenter()
1717
repositories {
1818
maven {
19+
name "local-repo"
1920
url System.getProperty("local.repo.path")
2021
}
2122
}

buildSrc/src/testKit/jarHell/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ repositories {
1515
jcenter()
1616
repositories {
1717
maven {
18+
name "local"
1819
url System.getProperty("local.repo.path")
1920
}
2021
}

buildSrc/src/testKit/testclusters/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ allprojects { all ->
99
dir System.getProperty("test.local-test-downloads-path")
1010
}
1111
maven {
12+
name "local"
1213
url System.getProperty("local.repo.path")
1314
}
1415
String luceneSnapshotRevision = System.getProperty("test.lucene-snapshot-revision")
1516
if (luceneSnapshotRevision != null) {
1617
maven {
18+
name "lucene-snapshots"
1719
url "https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/" + luceneSnapshotRevision
1820
}
1921
}

buildSrc/src/testKit/thirdPartyAudit/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ repositories {
1414
* - version 0.0.2 has the same class and one extra file just to make the jar different
1515
*/
1616
maven {
17+
name = "local-test"
1718
url = file("sample_jars/build/testrepo")
1819
}
1920
jcenter()

distribution/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ String hash = jdkVersionMatcher.group(4)
237237
repositories {
238238
// simpler legacy pattern from JDK 9 to JDK 12 that we are advocating to Oracle to bring back
239239
ivy {
240+
name "legacy-jdk"
240241
url "https://download.oracle.com"
241242
metadataSources {
242243
artifact()
@@ -247,6 +248,7 @@ repositories {
247248
}
248249
// current pattern since 12.0.1
249250
ivy {
251+
name "jdk"
250252
url "https://download.oracle.com"
251253
metadataSources {
252254
artifact()

distribution/packages/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import java.util.regex.Pattern
5353
buildscript {
5454
repositories {
5555
maven {
56+
name "gradle-plugins"
5657
url "https://plugins.gradle.org/m2/"
5758
}
5859
}

docs/java-api/index.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ For Gradle:
6868
["source","groovy",subs="attributes"]
6969
--------------------------------------------------
7070
maven {
71+
name "lucene-snapshots"
7172
url 'https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/00142c9'
7273
}
7374
--------------------------------------------------

docs/java-rest/high-level/getting-started.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ For Gradle:
104104
["source","groovy",subs="attributes"]
105105
--------------------------------------------------
106106
maven {
107+
name 'lucene-snapshots'
107108
url 'https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/83f9835'
108109
}
109110
--------------------------------------------------

docs/reference/setup/setup-xclient.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ repositories {
6565
6666
// Add the Elasticsearch Maven Repository
6767
maven {
68+
name "elastic"
6869
url "https://artifacts.elastic.co/maven"
6970
}
7071
}

qa/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ subprojects { Project subproj ->
1212
*/
1313
repositories {
1414
maven {
15+
name "elastic"
1516
url "https://artifacts.elastic.co/maven"
1617
}
1718
maven {
19+
name "elastic-snapshots"
1820
url "https://snapshots.elastic.co/maven"
1921
}
2022
}

qa/wildfly/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ int managementPort
3737
repositories {
3838
// the Wildfly distribution is not available via a repository, so we fake an Ivy repository on top of the download site
3939
ivy {
40+
name "wildfly"
4041
url "https://download.jboss.org"
4142
metadataSources {
4243
artifact()

x-pack/docs/en/watcher/java.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ repositories {
6060
6161
// Add the Elasticsearch Maven Repository
6262
maven {
63+
name "elastic"
6364
url "https://artifacts.elastic.co/maven"
6465
}
6566
}

x-pack/plugin/ml/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ esplugin {
1212

1313
repositories {
1414
ivy {
15-
name "prelert-artifacts"
15+
name "ml-cpp"
1616
url "https://prelert-artifacts.s3.amazonaws.com"
1717
metadataSources {
1818
// no repository metadata, look directly for the artifact

x-pack/qa/rolling-upgrade-basic/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,11 @@ project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackRestSpec)
143143

144144
repositories {
145145
maven {
146+
name "elastic"
146147
url "https://artifacts.elastic.co/maven"
147148
}
148149
maven {
150+
name "elastic-snapshots"
149151
url "https://snapshots.elastic.co/maven"
150152
}
151153
}

0 commit comments

Comments
 (0)