Provide names for all artifact repositories (#41857)
This commit adds a name for each Maven and Ivy repository used in the build.
This commit is contained in:
parent
3a35427b6d
commit
d7fd51a84e
|
@ -6,6 +6,7 @@ if (System.env.ELASTIC_ARTIFACTORY_USERNAME == null || System.env.ELASTIC_ARTIFA
|
||||||
settings.pluginManagement {
|
settings.pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
name "artifactory-gradle-plugins"
|
||||||
url "https://artifactory.elstc.co/artifactory/gradle-plugins"
|
url "https://artifactory.elstc.co/artifactory/gradle-plugins"
|
||||||
credentials {
|
credentials {
|
||||||
username System.env.ELASTIC_ARTIFACTORY_USERNAME
|
username System.env.ELASTIC_ARTIFACTORY_USERNAME
|
||||||
|
@ -21,6 +22,7 @@ if (System.env.ELASTIC_ARTIFACTORY_USERNAME == null || System.env.ELASTIC_ARTIFA
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
name "artifactory-gradle-release"
|
||||||
url "https://artifactory.elstc.co/artifactory/gradle-release/"
|
url "https://artifactory.elstc.co/artifactory/gradle-release/"
|
||||||
credentials {
|
credentials {
|
||||||
username System.env.ELASTIC_ARTIFACTORY_USERNAME
|
username System.env.ELASTIC_ARTIFACTORY_USERNAME
|
||||||
|
@ -31,6 +33,7 @@ if (System.env.ELASTIC_ARTIFACTORY_USERNAME == null || System.env.ELASTIC_ARTIFA
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
name "artifactory-gradle-release"
|
||||||
url "https://artifactory.elstc.co/artifactory/gradle-release/"
|
url "https://artifactory.elstc.co/artifactory/gradle-release/"
|
||||||
credentials {
|
credentials {
|
||||||
username System.env.ELASTIC_ARTIFACTORY_USERNAME
|
username System.env.ELASTIC_ARTIFACTORY_USERNAME
|
||||||
|
|
|
@ -88,7 +88,7 @@ subprojects {
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
name = 'localTest'
|
name = 'test'
|
||||||
url = "${rootProject.buildDir}/local-test-repo"
|
url = "${rootProject.buildDir}/local-test-repo"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@ if (project != rootProject) {
|
||||||
task integTest(type: Test) {
|
task integTest(type: Test) {
|
||||||
// integration test requires the local testing repo for example plugin builds
|
// integration test requires the local testing repo for example plugin builds
|
||||||
dependsOn project.rootProject.allprojects.collect {
|
dependsOn project.rootProject.allprojects.collect {
|
||||||
it.tasks.matching { it.name == 'publishNebulaPublicationToLocalTestRepository'}
|
it.tasks.matching { it.name == 'publishNebulaPublicationToTestRepository'}
|
||||||
}
|
}
|
||||||
dependsOn setupLocalDownloads
|
dependsOn setupLocalDownloads
|
||||||
exclude "**/*Tests.class"
|
exclude "**/*Tests.class"
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.gradle.api.artifacts.ModuleVersionIdentifier
|
||||||
import org.gradle.api.artifacts.ProjectDependency
|
import org.gradle.api.artifacts.ProjectDependency
|
||||||
import org.gradle.api.artifacts.ResolvedArtifact
|
import org.gradle.api.artifacts.ResolvedArtifact
|
||||||
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
||||||
|
import org.gradle.api.artifacts.repositories.ArtifactRepository
|
||||||
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
|
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
|
||||||
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
|
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
|
||||||
import org.gradle.api.credentials.HttpHeaderCredentials
|
import org.gradle.api.credentials.HttpHeaderCredentials
|
||||||
|
@ -585,11 +586,11 @@ class BuildPlugin implements Plugin<Project> {
|
||||||
project.getRepositories().all { repository ->
|
project.getRepositories().all { repository ->
|
||||||
if (repository instanceof MavenArtifactRepository) {
|
if (repository instanceof MavenArtifactRepository) {
|
||||||
final MavenArtifactRepository maven = (MavenArtifactRepository) repository
|
final MavenArtifactRepository maven = (MavenArtifactRepository) repository
|
||||||
assertRepositoryURIUsesHttps(project, maven.getUrl())
|
assertRepositoryURIUsesHttps(maven, project, maven.getUrl())
|
||||||
repository.getArtifactUrls().each { uri -> assertRepositoryURIUsesHttps(project, uri) }
|
repository.getArtifactUrls().each { uri -> assertRepositoryURIUsesHttps(project, uri) }
|
||||||
} else if (repository instanceof IvyArtifactRepository) {
|
} else if (repository instanceof IvyArtifactRepository) {
|
||||||
final IvyArtifactRepository ivy = (IvyArtifactRepository) repository
|
final IvyArtifactRepository ivy = (IvyArtifactRepository) repository
|
||||||
assertRepositoryURIUsesHttps(project, ivy.getUrl())
|
assertRepositoryURIUsesHttps(ivy, project, ivy.getUrl())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RepositoryHandler repos = project.repositories
|
RepositoryHandler repos = project.repositories
|
||||||
|
@ -601,6 +602,7 @@ class BuildPlugin implements Plugin<Project> {
|
||||||
}
|
}
|
||||||
repos.jcenter()
|
repos.jcenter()
|
||||||
repos.ivy {
|
repos.ivy {
|
||||||
|
name "elasticsearch"
|
||||||
url "https://artifacts.elastic.co/downloads"
|
url "https://artifacts.elastic.co/downloads"
|
||||||
patternLayout {
|
patternLayout {
|
||||||
artifact "elasticsearch/[module]-[revision](-[classifier]).[ext]"
|
artifact "elasticsearch/[module]-[revision](-[classifier]).[ext]"
|
||||||
|
@ -629,9 +631,9 @@ class BuildPlugin implements Plugin<Project> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void assertRepositoryURIUsesHttps(final Project project, final URI uri) {
|
private static void assertRepositoryURIUsesHttps(final ArtifactRepository repository, final Project project, final URI uri) {
|
||||||
if (uri != null && uri.toURL().getProtocol().equals("http")) {
|
if (uri != null && uri.toURL().getProtocol().equals("http")) {
|
||||||
throw new GradleException("repository on project with path [${project.path}] is using http for artifacts on [${uri.toURL()}]")
|
throw new GradleException("repository [${repository.name}] on project with path [${project.path}] is using http for artifacts on [${uri.toURL()}]")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,7 @@ class VagrantTestPlugin implements Plugin<Project> {
|
||||||
which should work for 5.0.0+. This isn't a real ivy repository but gradle
|
which should work for 5.0.0+. This isn't a real ivy repository but gradle
|
||||||
is fine with that */
|
is fine with that */
|
||||||
repos.ivy {
|
repos.ivy {
|
||||||
|
name "elasticsearch"
|
||||||
artifactPattern "https://artifacts.elastic.co/downloads/elasticsearch/[module]-[revision].[ext]"
|
artifactPattern "https://artifacts.elastic.co/downloads/elasticsearch/[module]-[revision].[ext]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ public class BuildExamplePluginsIT extends GradleIntegrationTestCase {
|
||||||
"buildscript {\n" +
|
"buildscript {\n" +
|
||||||
" repositories {\n" +
|
" repositories {\n" +
|
||||||
" maven {\n" +
|
" maven {\n" +
|
||||||
|
" name = \"test\"\n" +
|
||||||
" url = '" + getLocalTestRepoPath() + "'\n" +
|
" url = '" + getLocalTestRepoPath() + "'\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
|
@ -117,12 +118,14 @@ public class BuildExamplePluginsIT extends GradleIntegrationTestCase {
|
||||||
String luceneSnapshotRevision = System.getProperty("test.lucene-snapshot-revision");
|
String luceneSnapshotRevision = System.getProperty("test.lucene-snapshot-revision");
|
||||||
if (luceneSnapshotRepo != null) {
|
if (luceneSnapshotRepo != null) {
|
||||||
luceneSnapshotRepo = " maven {\n" +
|
luceneSnapshotRepo = " maven {\n" +
|
||||||
|
" name \"lucene-snapshots\"\n" +
|
||||||
" url \"https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/" + luceneSnapshotRevision + "\"\n" +
|
" url \"https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/" + luceneSnapshotRevision + "\"\n" +
|
||||||
" }\n";
|
" }\n";
|
||||||
}
|
}
|
||||||
writeBuildScript("\n" +
|
writeBuildScript("\n" +
|
||||||
"repositories {\n" +
|
"repositories {\n" +
|
||||||
" maven {\n" +
|
" maven {\n" +
|
||||||
|
" name \"test\"\n" +
|
||||||
" url \"" + getLocalTestRepoPath() + "\"\n" +
|
" url \"" + getLocalTestRepoPath() + "\"\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
" flatDir {\n" +
|
" flatDir {\n" +
|
||||||
|
|
|
@ -16,6 +16,7 @@ repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
name "local-repo"
|
||||||
url System.getProperty("local.repo.path")
|
url System.getProperty("local.repo.path")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
name "local"
|
||||||
url System.getProperty("local.repo.path")
|
url System.getProperty("local.repo.path")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,13 @@ allprojects { all ->
|
||||||
dir System.getProperty("test.local-test-downloads-path")
|
dir System.getProperty("test.local-test-downloads-path")
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
|
name "local"
|
||||||
url System.getProperty("local.repo.path")
|
url System.getProperty("local.repo.path")
|
||||||
}
|
}
|
||||||
String luceneSnapshotRevision = System.getProperty("test.lucene-snapshot-revision")
|
String luceneSnapshotRevision = System.getProperty("test.lucene-snapshot-revision")
|
||||||
if (luceneSnapshotRevision != null) {
|
if (luceneSnapshotRevision != null) {
|
||||||
maven {
|
maven {
|
||||||
|
name "lucene-snapshots"
|
||||||
url "https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/" + luceneSnapshotRevision
|
url "https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/" + luceneSnapshotRevision
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ repositories {
|
||||||
* - version 0.0.2 has the same class and one extra file just to make the jar different
|
* - version 0.0.2 has the same class and one extra file just to make the jar different
|
||||||
*/
|
*/
|
||||||
maven {
|
maven {
|
||||||
|
name = "local-test"
|
||||||
url = file("sample_jars/build/testrepo")
|
url = file("sample_jars/build/testrepo")
|
||||||
}
|
}
|
||||||
jcenter()
|
jcenter()
|
||||||
|
|
|
@ -237,6 +237,7 @@ String hash = jdkVersionMatcher.group(4)
|
||||||
repositories {
|
repositories {
|
||||||
// simpler legacy pattern from JDK 9 to JDK 12 that we are advocating to Oracle to bring back
|
// simpler legacy pattern from JDK 9 to JDK 12 that we are advocating to Oracle to bring back
|
||||||
ivy {
|
ivy {
|
||||||
|
name "legacy-jdk"
|
||||||
url "https://download.oracle.com"
|
url "https://download.oracle.com"
|
||||||
metadataSources {
|
metadataSources {
|
||||||
artifact()
|
artifact()
|
||||||
|
@ -247,6 +248,7 @@ repositories {
|
||||||
}
|
}
|
||||||
// current pattern since 12.0.1
|
// current pattern since 12.0.1
|
||||||
ivy {
|
ivy {
|
||||||
|
name "jdk"
|
||||||
url "https://download.oracle.com"
|
url "https://download.oracle.com"
|
||||||
metadataSources {
|
metadataSources {
|
||||||
artifact()
|
artifact()
|
||||||
|
|
|
@ -53,6 +53,7 @@ import java.util.regex.Pattern
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
name "gradle-plugins"
|
||||||
url "https://plugins.gradle.org/m2/"
|
url "https://plugins.gradle.org/m2/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ For Gradle:
|
||||||
["source","groovy",subs="attributes"]
|
["source","groovy",subs="attributes"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
maven {
|
maven {
|
||||||
|
name "lucene-snapshots"
|
||||||
url 'https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/00142c9'
|
url 'https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/00142c9'
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
|
@ -104,6 +104,7 @@ For Gradle:
|
||||||
["source","groovy",subs="attributes"]
|
["source","groovy",subs="attributes"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
maven {
|
maven {
|
||||||
|
name 'lucene-snapshots'
|
||||||
url 'https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/83f9835'
|
url 'https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/83f9835'
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
|
@ -65,6 +65,7 @@ repositories {
|
||||||
|
|
||||||
// Add the Elasticsearch Maven Repository
|
// Add the Elasticsearch Maven Repository
|
||||||
maven {
|
maven {
|
||||||
|
name "elastic"
|
||||||
url "https://artifacts.elastic.co/maven"
|
url "https://artifacts.elastic.co/maven"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,11 @@ subprojects { Project subproj ->
|
||||||
*/
|
*/
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
name "elastic"
|
||||||
url "https://artifacts.elastic.co/maven"
|
url "https://artifacts.elastic.co/maven"
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
|
name "elastic-snapshots"
|
||||||
url "https://snapshots.elastic.co/maven"
|
url "https://snapshots.elastic.co/maven"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ int managementPort
|
||||||
repositories {
|
repositories {
|
||||||
// the Wildfly distribution is not available via a repository, so we fake an Ivy repository on top of the download site
|
// the Wildfly distribution is not available via a repository, so we fake an Ivy repository on top of the download site
|
||||||
ivy {
|
ivy {
|
||||||
|
name "wildfly"
|
||||||
url "https://download.jboss.org"
|
url "https://download.jboss.org"
|
||||||
metadataSources {
|
metadataSources {
|
||||||
artifact()
|
artifact()
|
||||||
|
|
|
@ -60,6 +60,7 @@ repositories {
|
||||||
|
|
||||||
// Add the Elasticsearch Maven Repository
|
// Add the Elasticsearch Maven Repository
|
||||||
maven {
|
maven {
|
||||||
|
name "elastic"
|
||||||
url "https://artifacts.elastic.co/maven"
|
url "https://artifacts.elastic.co/maven"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ esplugin {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
ivy {
|
ivy {
|
||||||
name "prelert-artifacts"
|
name "ml-cpp"
|
||||||
url "https://prelert-artifacts.s3.amazonaws.com"
|
url "https://prelert-artifacts.s3.amazonaws.com"
|
||||||
metadataSources {
|
metadataSources {
|
||||||
// no repository metadata, look directly for the artifact
|
// no repository metadata, look directly for the artifact
|
||||||
|
|
|
@ -145,9 +145,11 @@ project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackRestSpec)
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
name "elastic"
|
||||||
url "https://artifacts.elastic.co/maven"
|
url "https://artifacts.elastic.co/maven"
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
|
name "elastic-snapshots"
|
||||||
url "https://snapshots.elastic.co/maven"
|
url "https://snapshots.elastic.co/maven"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue