diff --git a/build-conventions/build.gradle b/build-conventions/build.gradle index cce33d4699570..f540e7680fbfa 100644 --- a/build-conventions/build.gradle +++ b/build-conventions/build.gradle @@ -66,7 +66,7 @@ dependencies { api 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0' api 'org.apache.rat:apache-rat:0.11' compileOnly "com.puppycrawl.tools:checkstyle:8.42" - api('com.diffplug.spotless:spotless-plugin-gradle:5.16.0') { + api('com.diffplug.spotless:spotless-plugin-gradle:6.0.0') { exclude module: "groovy-xml" } } diff --git a/build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/precommit/FormattingPrecommitPlugin.java b/build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/precommit/FormattingPrecommitPlugin.java index 3bff5bcdf67e0..f106ad01b5212 100644 --- a/build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/precommit/FormattingPrecommitPlugin.java +++ b/build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/precommit/FormattingPrecommitPlugin.java @@ -50,6 +50,9 @@ public void apply(Project project) { project.getPlugins().apply(PrecommitTaskPlugin.class); project.getPlugins().apply(SpotlessPlugin.class); + // Spotless resolves required dependencies from project repositories, so we need maven central + project.getRepositories().mavenCentral(); + project.getExtensions().getByType(SpotlessExtension.class).java(java -> { String importOrderPath = "build-conventions/elastic.importorder"; String formatterConfigPath = "build-conventions/formatterConfig.xml";