diff --git a/plugins/examples/build.gradle b/plugins/examples/build.gradle index b60485edd1cb8..6a66f5d2a5567 100644 --- a/plugins/examples/build.gradle +++ b/plugins/examples/build.gradle @@ -1,15 +1,16 @@ import org.elasticsearch.gradle.VersionProperties buildscript { - repositories { - maven { - url = 'https://snapshots.elastic.co/maven/' + repositories { + maven { + url = 'https://snapshots.elastic.co/maven/' + } + mavenCentral() + gradlePluginPortal() + } + dependencies { + classpath "org.elasticsearch.gradle:build-tools:${elasticsearchVersion}" } - mavenCentral() - } - dependencies { - classpath "org.elasticsearch.gradle:build-tools:${elasticsearchVersion}" - } } subprojects { @@ -25,13 +26,13 @@ subprojects { maven { url = 'https://snapshots.elastic.co/maven/' mavenContent { - if (gradle.includedBuilds) { + if (gradle.includedBuilds || gradle.parent != null) { // When building in a composite, restrict this to only resolve the Java REST client includeModule 'co.elastic.clients', 'elasticsearch-java' } } } - if (gradle.includedBuilds.isEmpty()) { + if (gradle.includedBuilds.isEmpty() && gradle.parent == null) { maven { url = "https://artifacts-snapshot.elastic.co/elasticsearch/${elasticsearchVersion}/maven" mavenContent { diff --git a/plugins/examples/custom-processor/src/main/java/org/elasticsearch/example/customprocessor/ExampleRepeatProcessor.java b/plugins/examples/custom-processor/src/main/java/org/elasticsearch/example/customprocessor/ExampleRepeatProcessor.java index f0f942459281a..b90781da7ff5a 100644 --- a/plugins/examples/custom-processor/src/main/java/org/elasticsearch/example/customprocessor/ExampleRepeatProcessor.java +++ b/plugins/examples/custom-processor/src/main/java/org/elasticsearch/example/customprocessor/ExampleRepeatProcessor.java @@ -1,5 +1,6 @@ package org.elasticsearch.example.customprocessor; +import org.elasticsearch.cluster.metadata.ProjectId; import org.elasticsearch.ingest.AbstractProcessor; import org.elasticsearch.ingest.ConfigurationUtils; import org.elasticsearch.ingest.IngestDocument; @@ -38,13 +39,13 @@ public String getType() { } public static class Factory implements Processor.Factory { - @Override public ExampleRepeatProcessor create( Map registry, String tag, String description, - Map config + Map config, + ProjectId projectId ) { String field = ConfigurationUtils.readStringProperty(TYPE, tag, config, FIELD_KEY_NAME); return new ExampleRepeatProcessor(tag, description, field); diff --git a/plugins/examples/gradle.properties b/plugins/examples/gradle.properties index 5d5c040791fee..7c781d859cea6 100644 --- a/plugins/examples/gradle.properties +++ b/plugins/examples/gradle.properties @@ -1,10 +1,24 @@ -# - # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - # or more contributor license agreements. Licensed under the "Elastic License - # 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - # Public License v 1"; you may not use this file except in compliance with, at - # your election, the "Elastic License 2.0", the "GNU Affero General Public - # License v3.0 only", or the "Server Side Public License, v 1". -# -version=1.0.0-SNAPSHOT -group=org.elasticsearch.examples +org.gradle.welcome=never +org.gradle.warning.mode=none +org.gradle.parallel=true +# We need to declare --add-exports to make spotless working seamlessly with jdk16 +org.gradle.jvmargs=-XX:+HeapDumpOnOutOfMemoryError -Xss2m --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED + +# Enforce the build to fail on deprecated gradle api usage +systemProp.org.gradle.warning.mode=fail + +# forcing to use TLS1.2 to avoid failure in vault +# see https://github.com/hashicorp/vault/issues/8750#issuecomment-631236121 +systemProp.jdk.tls.client.protocols=TLSv1.2 + +# java homes resolved by environment variables +org.gradle.java.installations.auto-detect=false + +# log some dependency verification info to console +org.gradle.dependency.verification.console=verbose + +# allow user to specify toolchain via the RUNTIME_JAVA_HOME environment variable +org.gradle.java.installations.fromEnv=RUNTIME_JAVA_HOME + +# if configuration cache enabled then enable parallel support too +org.gradle.configuration-cache.parallel=true diff --git a/plugins/examples/settings.gradle b/plugins/examples/settings.gradle index 6b20792e99f76..64e3a583a44f2 100644 --- a/plugins/examples/settings.gradle +++ b/plugins/examples/settings.gradle @@ -32,7 +32,14 @@ gradle.rootProject { } gradle.projectsEvaluated { - if (gradle.includedBuilds) { + if (gradle.includedBuilds || gradle.parent != null) { + pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } + includeBuild "../../build-tools" + } gradle.allprojects { configurations.all { resolutionStrategy.dependencySubstitution {