@@ -84,15 +84,9 @@ def local_name(tag):
8484 module = Module (path , group_id , artifact_id , parent_coords )
8585
8686 # Dependencies
87- def add_dependencies (section , is_management = False ):
87+ def add_dependencies (section ):
8888 if section is not None :
8989 for dep in section .findall ("mvn:dependency" , NS ):
90- if is_management :
91- # Only include 'import' scope dependencies from dependencyManagement
92- scope = dep .find ("mvn:scope" , NS )
93- if scope is None or scope .text != "import" :
94- continue
95-
9690 d_group = dep .find ("mvn:groupId" , NS )
9791 d_artifact = dep .find ("mvn:artifactId" , NS )
9892 if d_group is not None and d_artifact is not None :
@@ -102,7 +96,7 @@ def add_dependencies(section, is_management=False):
10296
10397 dep_mgmt = root .find ("mvn:dependencyManagement" , NS )
10498 if dep_mgmt is not None :
105- add_dependencies (dep_mgmt .find ("mvn:dependencies" , NS ), is_management = True )
99+ add_dependencies (dep_mgmt .find ("mvn:dependencies" , NS ))
106100
107101 # Plugin dependencies
108102 build = root .find ("mvn:build" , NS )
@@ -171,6 +165,12 @@ def build_graph(
171165 # Regular dependencies
172166 for dep_key in module .dependencies :
173167 if dep_key in modules :
168+ # Prevent cycle: If I am the parent of the dependency, ignore it.
169+ # (Parent manages Child -> Child depends on Parent)
170+ dep_module = modules [dep_key ]
171+ if dep_module .parent == key :
172+ continue
173+
174174 graph [key ].add (dep_key )
175175
176176 return modules , graph
0 commit comments