diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/KobaltMavenResolver.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/KobaltMavenResolver.kt index 69192c20..0320d456 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/KobaltMavenResolver.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/KobaltMavenResolver.kt @@ -45,7 +45,8 @@ class KobaltMavenResolver @Inject constructor(val settings: KobaltSettings, fun resolve(artifact: Artifact, scope: Scope? = null, filter: DependencyFilter? = null) = resolve(artifactToId(artifact), scope, filter) - fun resolveToIds(id: String, scope: Scope? = null, filter: DependencyFilter? = null) : List { + fun resolveToIds(id: String, scope: Scope? = null, filter: DependencyFilter? = null, + seen: HashSet = hashSetOf()) : List { val rr = resolve(id, scope, filter) val children = rr.root.children.filter { @@ -55,7 +56,12 @@ class KobaltMavenResolver @Inject constructor(val settings: KobaltSettings, } val result = listOf(artifactToId(rr.root.artifact)) + children.flatMap { val thisId = artifactToId(it.artifact) - resolveToIds(thisId, scope, filter) + if (! seen.contains(thisId)) { + seen.add(thisId) + resolveToIds(thisId, scope, filter, seen) + } else { + emptyList() + } } return result }