diff --git a/fix/file_fix_maven.go b/fix/file_fix_maven.go index 4f2ea16..8ad6fd3 100644 --- a/fix/file_fix_maven.go +++ b/fix/file_fix_maven.go @@ -184,7 +184,9 @@ func (p *mavenParams) getFixModelList(params FixParams, pomPathList []string) { for _, comp := range params.CompList { for _, pomPath := range pomPathList { list := GetFixModelList(filepath.Join(params.Dir, pomPath), pomPath, comp.CompName, comp.CompVersion, comp.MinFixVersion, p.propertyMap) - p.fixModelList = append(p.fixModelList, list...) + if len(list) > 0 { + p.fixModelList = append(p.fixModelList, list...) + } } } diff --git a/fix/xml_tools.go b/fix/xml_tools.go index 810f1ea..830531e 100644 --- a/fix/xml_tools.go +++ b/fix/xml_tools.go @@ -83,15 +83,18 @@ func (l *ChildXMLListener) EnterElement(ctx *parser.ElementContext) { if propertyModel, ok := l.modelMap[model.OldVersion]; ok { for _, m := range propertyModel { - newModel := FixModel{ - Line: m.Line, - OldVersion: model.OldVersion, - NewVersion: l.newVersion, - CompName: l.compName, - PomPath: l.pomPath, - relativePomPath: l.relativePomPath, + if m.OldVersion == l.compVersion { + newModel := FixModel{ + Line: m.Line, + OldVersion: model.OldVersion, + NewVersion: l.newVersion, + CompName: l.compName, + PomPath: l.pomPath, + relativePomPath: l.relativePomPath, + } + l.fixModelList = append(l.fixModelList, newModel) } - l.fixModelList = append(l.fixModelList, newModel) + } } } else {