From 25ce08f02fd9c96c4ce82dcf88144a5889e37d63 Mon Sep 17 00:00:00 2001 From: wangxiaodong <645775992@qq.com> Date: Tue, 16 May 2023 15:22:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=89=88=E6=9C=AC=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fix/file_fix_maven.go | 4 +++- fix/xml_tools.go | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) 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 {