elasticsearch/plugins/examples/build.gradle
Mariusz Józala d4045e2152
[Test] Use version range for elasticsearch-java (#127398)
Snapshot builds of elasticsearch-java are no longer available.
Using the current major highest version should be safe according to the
compatibility guarantees described on https://github.com/elastic/elasticsearch-java?tab=readme-ov-file#compatibility

Repo https://snapshots.elastic.co/maven/ is no longer needed in a
composite build. Previously it was only used to provide snapshot version
 of `elasticsearch-java` client which is no longer available in snapshot
  version. We keep the https://snapshots.elastic.co/maven/ repo to be
  used when for non-composite builds when any other dependencies
  snapshot versions can be fetched.
2025-05-05 13:58:17 +02:00

57 lines
1.5 KiB
Groovy

import org.elasticsearch.gradle.VersionProperties
buildscript {
repositories {
maven {
url = 'https://snapshots.elastic.co/maven/'
}
mavenCentral()
}
dependencies {
classpath "org.elasticsearch.gradle:build-tools:${elasticsearchVersion}"
}
}
subprojects {
apply plugin: 'java'
java {
sourceCompatibility = 21
targetCompatibility = 21
}
repositories {
// Only necessary when building plugins against SNAPSHOT versions of Elasticsearch
if (gradle.includedBuilds.isEmpty()) {
maven {
url = "https://artifacts-snapshot.elastic.co/elasticsearch/${elasticsearchVersion}/maven"
mavenContent {
includeModule 'org.elasticsearch', 'elasticsearch'
}
}
maven {
url = 'https://snapshots.elastic.co/maven/'
}
}
// Same for Lucene, add the snapshot repo based on the currently used Lucene version
def luceneVersion = VersionProperties.getLucene()
if (luceneVersion.contains('-snapshot')) {
def matcher = luceneVersion =~ /[0-9\.]+-snapshot-([a-z0-9]+)/
assert matcher.matches(): "Invalid Lucene snapshot version '${luceneVersion}'"
maven {
url = "https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/${matcher.group(1)}"
}
}
mavenCentral()
}
}
tasks.register('check') {
dependsOn subprojects.collect { it.tasks.named('check') }
}
tasks.register('precommit') {
dependsOn subprojects.collect { it.tasks.named('classes') }
}