elasticsearch/plugins/examples/build.gradle
2024-09-26 20:05:44 -05:00

63 lines
1.7 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
maven {
url = 'https://snapshots.elastic.co/maven/'
mavenContent {
if (gradle.includedBuilds) {
// When building in a composite, restrict this to only resolve the Java REST client
includeModule 'co.elastic.clients', 'elasticsearch-java'
}
}
}
if (gradle.includedBuilds.isEmpty()) {
maven {
url = "https://artifacts-snapshot.elastic.co/elasticsearch/${elasticsearchVersion}/maven"
mavenContent {
includeModule 'org.elasticsearch', 'elasticsearch'
}
}
}
// 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') }
}