@@ -183,7 +183,7 @@ func inheritModules(poms []*Pom) {
183183type getPomFunc func (dep PomDependency , repos ... []string ) * Pom
184184
185185// inheritPom 继承pom所需内容
186- func inheritPom (pom * Pom , inheritDependencies bool , getpom getPomFunc ) {
186+ func inheritPom (pom * Pom , getpom getPomFunc ) {
187187
188188 // 记录统计过的parent 避免pom循环引用
189189 parentSet := map [string ]bool {}
@@ -218,9 +218,7 @@ func inheritPom(pom *Pom, inheritDependencies bool, getpom getPomFunc) {
218218 pom .DependencyManagement = append (pom .DependencyManagement , parentPom .DependencyManagement ... )
219219
220220 // 继承dependencies
221- if inheritDependencies {
222- pom .Dependencies = append (pom .Dependencies , parentPom .Dependencies ... )
223- }
221+ pom .Dependencies = append (pom .Dependencies , parentPom .Dependencies ... )
224222
225223 // 继承repo&mirror
226224 pom .Repositories = append (pom .Repositories , parentPom .Repositories ... )
@@ -294,7 +292,7 @@ func parsePom(ctx context.Context, pom *Pom, getpom getPomFunc) *model.DepGraph
294292 pom .Update (& pom .PomDependency )
295293
296294 // 继承pom
297- inheritPom (pom , true , getpom )
295+ inheritPom (pom , getpom )
298296
299297 // 记录在根pom的dependencyManagement中非import组件信息
300298 rootPomManagement := map [string ]* PomDependency {}
@@ -406,8 +404,8 @@ func parsePom(ctx context.Context, pom *Pom, getpom getPomFunc) *model.DepGraph
406404 subpom .PomDependency = * dep
407405 // 继承根pom的exclusion
408406 subpom .Exclusions = append (subpom .Exclusions , np .Exclusions ... )
409- // 子依赖不继承parent的依赖项
410- inheritPom (subpom , false , getpom )
407+ // 依赖继承parent
408+ inheritPom (subpom , getpom )
411409 sub .Expand = subpom
412410 }
413411
0 commit comments