diff --git a/src/main/java/com/wangym/lombok/job/impl/MavenDependencyVersionReplaceJob.java b/src/main/java/com/wangym/lombok/job/impl/MavenDependencyVersionReplaceJob.java index baf1aae..c65b3f3 100644 --- a/src/main/java/com/wangym/lombok/job/impl/MavenDependencyVersionReplaceJob.java +++ b/src/main/java/com/wangym/lombok/job/impl/MavenDependencyVersionReplaceJob.java @@ -73,6 +73,7 @@ class ModelWrapper { // 白名单列表 private List standardList = Arrays.asList("java.version", "project.version"); + private List unusedVersionKey = new ArrayList<>(); public ModelWrapper(DependencyVersionService dvService, Model model) { super(); @@ -105,6 +106,13 @@ public void process() { deleteDuplicateDependencies(dm.getDependencies()); } mergeProperty(); + + doAfter(); + } + + private void doAfter() { + //因为是不标准的版本属性声明,需要显式指定进行删除 + unusedVersionKey.forEach(it -> model.getProperties().remove(it)); } private List getDependencyOfDependencyManagement() { @@ -135,8 +143,8 @@ private void processDependency(Dependency d){ String realVer; if (version.contains("$")) { realVer = getRefVersionValue(d); - //因为是不标准的版本属性声明,需要显式指定进行删除 - model.getProperties().remove(getRefVersionKey(version)); + //可能会有对个依赖引用了同一个属性,得放在最后处理 + unusedVersionKey.add(getRefVersionKey(version)); } else { realVer = version; } diff --git a/src/test/resources/pom.xml b/src/test/resources/pom.xml index 30b49a1..ea85e29 100644 --- a/src/test/resources/pom.xml +++ b/src/test/resources/pom.xml @@ -99,6 +99,12 @@ pom import + + + commons-lang + commons-lang + ${project.version} +