From 53e26947c5c7d43608275c6f3e95067bde355f71 Mon Sep 17 00:00:00 2001 From: Rene Groeschke Date: Tue, 14 Oct 2025 09:33:15 +0200 Subject: [PATCH] [IDEA] Enforce clean dependency refresh for Gradle Dependencies (#136490) We enforce a full rewrite of module dependencies. We have seen problems with idea classpaths when major dependency updates have been made (e.g. lucene updates). This should avoid keeping stale dependencies on the idea classpath causing trouble for our engineers. --- .../src/main/groovy/elasticsearch.ide.gradle | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build-tools-internal/src/main/groovy/elasticsearch.ide.gradle b/build-tools-internal/src/main/groovy/elasticsearch.ide.gradle index 665f4f8b276bc..809725609998e 100644 --- a/build-tools-internal/src/main/groovy/elasticsearch.ide.gradle +++ b/build-tools-internal/src/main/groovy/elasticsearch.ide.gradle @@ -21,6 +21,17 @@ import java.nio.file.StandardCopyOption allprojects { apply plugin: 'idea' + // We got reports of invalid idea classpaths when major classpath changes (e.g. lucene update) + // has been merged and developers switching back and forth. This should enforce idea + // to not try to be smart. + // This enforces A "complete rewrite" causing all existing content to be discarded, + // thereby losing any changes made directly in the IDE but that should be fine for us. + idea.module.iml { + beforeMerged { module -> + module.dependencies.clear() + } + } + tasks.named('idea').configure { doFirst { throw new GradleException("Use of the 'idea' task has been deprecated. For details on importing into IntelliJ see CONTRIBUTING.md.") } }