Skip to content

Commit

Permalink
--taskid=ID20230908
Browse files Browse the repository at this point in the history
引用的verion版本声明,定义的变量不规范,需要规范化
  • Loading branch information
xinluke committed Sep 8, 2023
1 parent b3e6a07 commit cb5205c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ private List<Dependency> getDependencyOfDependencyManagement() {
.orElse(Collections.emptyList());
}
private void processDependency(Dependency d){
String a = d.getArtifactId();
String artifactId = d.getArtifactId();
String version = d.getVersion();
if(dvService.getHiddenVersionArtifactIdList().contains(a)) {
if(dvService.getHiddenVersionArtifactIdList().contains(artifactId)) {
// 去除版本号相关声明
d.setVersion(null);
notifyHasModify();
Expand All @@ -137,6 +137,14 @@ private void processDependency(Dependency d){
d.setVersion(null);
notifyHasModify();
}
//定义的变量不规范,需要规范化
String newVersion = getNewVersion(artifactId);
String realVer = getRefVersionValue(d);
if (!d.getVersion().equals(newVersion) && StringUtils.isNotEmpty(realVer)) {
unusedVersionKey.add(getRefVersionKey(version));
insertProperty(artifactId, realVer);
d.setVersion(newVersion);
}
} else if (StringUtils.isNotEmpty(version)) {
//这种情况,说明是引用了属性的变量,但是不是很规范
//需要统一规范一下
Expand All @@ -149,8 +157,8 @@ private void processDependency(Dependency d){
realVer = version;
}
// 如果是原始的值类型的版本号才进行处理
insertProperty(a, realVer);
d.setVersion(getNewVersion(a));
insertProperty(artifactId, realVer);
d.setVersion(getNewVersion(artifactId));
notifyHasModify();
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/test/resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<stat-service-api.version>1.44.0</stat-service-api.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -74,6 +75,12 @@
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<!--不标准的定义-->
<dependency>
<groupId>com.wangym</groupId>
<artifactId>stat-services-api</artifactId>
<version>${stat-service-api.version}</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
Expand Down

0 comments on commit cb5205c

Please sign in to comment.