File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
main/groovy/org/codehaus/groovy/grails/resolve/maven/aether/config
test/groovy/org/codehaus/groovy/grails/resolve/maven Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ class AetherDsl {
196196 callable. call()
197197
198198 this . aetherDependencyManager. repositories. addAll(rc. repositories)
199+ this . aetherDependencyManager. repositories. unique()
199200 }
200201
201202 /**
Original file line number Diff line number Diff line change @@ -618,4 +618,30 @@ class AetherDependencyManagerSpec extends Specification {
618618 report != null
619619 ! report. hasError()
620620 }
621+
622+ void " Test duplicated repositories" () {
623+ given : " A dependency manager instance"
624+ def dependencyManager = new AetherDependencyManager ()
625+ dependencyManager. parseDependencies {
626+ repositories {
627+ mavenCentral()
628+ mavenRepo " https://repo.grails.org/grails/core"
629+ }
630+ }
631+
632+ when : " Another set of dependencies are parsed (like an inline plugin)"
633+ dependencyManager. parseDependencies {
634+ repositories {
635+ mavenCentral()
636+ mavenRepo " https://repo.grails.org/grails/core"
637+ }
638+ }
639+
640+ then : " only the unique set of repositories remain"
641+ dependencyManager. repositories. size == 2
642+
643+ and : " the declaration order is retained"
644+ dependencyManager. repositories[0 ]. id == " mavenCentral"
645+ dependencyManager. repositories[1 ]. url == " https://repo.grails.org/grails/core"
646+ }
621647}
You can’t perform that action at this time.
0 commit comments