Skip to content

Apache Lucene open-source search software

avoid-circular-jar-checks (#12618)

Kevin Risden75da33836b16
diff --git a/gradle/validation/jar-checks.gradle b/gradle/validation/jar-checks.gradle
index 90cf31e92bb..f0fff470f35 100644
--- a/gradle/validation/jar-checks.gradle
+++ b/gradle/validation/jar-checks.gradle
@@ -110,14 +110,21 @@ subprojects {
}
def visited = new HashSet<>()
+ def seenDeps = new HashSet<>()
def infos = []
while (!queue.isEmpty()) {
def dep = queue.removeFirst()
+ seenDeps.add(dep)
// Skip any artifacts from Lucene modules.
if (!dep.moduleGroup.startsWith("org.apache.lucene")) {
- queue.addAll(dep.children)
+ // Make sure we don't keep visiting the same children over and over again
+ dep.children.each { child ->
+ if (!seenDeps.contains(child)) {
+ queue.add(child)
+ }
+ }
dep.moduleArtifacts.each { resolvedArtifact ->
def file = resolvedArtifact.file
if (visited.add(file)) {