提交 82b86147 authored 作者: 王林巧's avatar 王林巧

删除无用类

上级 1ed63cf5
package com.msl;
import com.msl.java.FeignClassAnnotationUpdater;
import com.msl.java.FeignMethodAnnotationUpdater1;
import com.msl.java.FeignMethodAnnotationUpdater2;
import com.msl.java.JavaNormalUpdater;
import com.msl.xml.XmlNormalUpdater;
import java.util.ArrayList;
......@@ -18,11 +14,11 @@ public class FileUpdaterManager {
private final static List<FileUpdater> UPDATERS = new ArrayList<>();
static {
// register(new XmlNormalUpdater());
register(new XmlNormalUpdater());
// register(new JavaNormalUpdater());
register(new FeignClassAnnotationUpdater());
register(new FeignMethodAnnotationUpdater1());
register(new FeignMethodAnnotationUpdater2());
// register(new FeignClassAnnotationUpdater());
// register(new FeignMethodAnnotationUpdater1());
// register(new FeignMethodAnnotationUpdater2());
}
public static void register(FileUpdater fileUpdater) {
......
......@@ -22,8 +22,7 @@ public class Main {
public static void main(String[] args) throws Exception {
// doReplace("D:\\develop\\clx_projects\\msl-supervise\\supervise-web");
// doReplace("D:\\develop\\clx_projects\\msl-common-starter\\log-spring-boot-starter");
// doReplace("/Users/wanglinqiao/IdeaProjects/msl-supervise-trade");
doReplace("/Users/wanglinqiao/IdeaProjects/msl-transport-data/transport-data-api");
doReplace("D:\\develop\\clx_projects\\msl-quality");
}
public static void doReplace(String path) throws Exception {
......
package com.msl;
import com.google.common.collect.Sets;
import lombok.SneakyThrows;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author wanglq
* Date 2024/8/12
* Time 13:59
*/
public class Test2 {
public static Pattern dependency = Pattern.compile("<dependency>.+</dependency>");
public static Pattern version = Pattern.compile("<version>(\\d|\\.|\\w)+</version>");
public static Set<String> ignore = Sets.newHashSet("trade-service", "msl-parent",
"swagger-bootstrap-ui-demo","archetype","clx-contract","clx-setting","code-statistics","code-tool","cola","order-service");
public static void main(String[] args) {
File file = new File("d:/develop/clx_projects");
File[] projects = file.listFiles();
for (File project : projects) {
String projectName = project.getName();
if (ignore.contains(projectName)) {
continue;
}
if (projectName.equals("trade")) {
for (File subProject : project.listFiles()) {
doScan(subProject, subProject.getName());
}
} else {
doScan(project, projectName);
}
}
}
public static void doScan(File file, String projectName) {
if (file.getPath().contains("msl-parent")) {
return;
}
if (file.isDirectory()) {
for (File f : file.listFiles()) {
doScan(f, projectName);
}
} else if (file.getName().equals("pom.xml")) {
checkFileContent(file, projectName);
}
}
@SneakyThrows
private static void checkFileContent(File file, String projectName) {
String content = FileUtils.readFileToString(file, "UTF-8");
content = content.replace("\r\n", "");
// content = content.replace("<dependencies>", "\r\n<dependencies>");
// content = content.replace("</dependencies>", "\r\n</dependencies>");
content = content.replace("<dependency>", "\r\n<dependency>");
Matcher matcher = dependency.matcher(content);
// String path = file.getPath();
// path = path.substring(24);
// path = path.substring(0, path.indexOf("\\"));
while (matcher.find()) {
String group = matcher.group();
if (group.contains("version") && !group.contains("SNAPSHOT")) {
System.out.println("************************************************************************************************************************************");
System.out.println("************************************************************************************************************************************");
System.out.println(projectName);
print(group);
}
}
}
public static void print(String de) {
System.out.println(de.replaceAll(" +", "\r\n"));
}
}
......@@ -20,11 +20,15 @@ public class JavaNormalUpdater extends NormalUpdater {
LIST.add(Pair.with("import javax.servlet", "import jakarta.servlet"));
LIST.add(Pair.with("import javax.validation", "import jakarta.validation"));
LIST.add(Pair.with("import org.apache.commons.lang.ObjectUtils;","import org.apache.commons.lang3.ObjectUtils;"));
LIST.add(Pair.with("import org.apache.commons.lang.StringUtils;","import org.apache.commons.lang3.StringUtils;"));
// swagger 相关
LIST.add(Pair.with("import io.swagger.annotations.ApiModelProperty;", "import io.swagger.v3.oas.annotations.media.Schema;"));
LIST.add(Pair.with("@ApiModelProperty(value", "@Schema(description"));
LIST.add(Pair.with("@ApiModelProperty(\"", "@Schema(description=\""));
LIST.add(Pair.with("@ApiModelProperty(hidden = true)", "@Schema(hidden = true)"));
LIST.add(Pair.with("@ApiModelProperty(hidden = true, value = \"", "@Schema(hidden = true, description = \""));
LIST.add(Pair.with("@ApiModelProperty\n", "@Schema\n"));
LIST.add(Pair.with("import io.swagger.annotations.Api;", "import io.swagger.v3.oas.annotations.tags.Tag;"));
......@@ -38,9 +42,20 @@ public class JavaNormalUpdater extends NormalUpdater {
LIST.add(Pair.with("import io.swagger.annotations.ApiParam;", "import io.swagger.v3.oas.annotations.Parameter;"));
LIST.add(Pair.with("@ApiParam(\"", "@Parameter(name = \""));
LIST.add(Pair.with("@ApiParam(value = \"", "@Parameter(name = \""));
LIST.add(Pair.with("import io.swagger.annotations.ApiModel;","import io.swagger.v3.oas.annotations.media.Schema;"));
LIST.add(Pair.with("@ApiModel(value = \"","@Schema(description = \""));
LIST.add(Pair.with("@ApiModel(\"","@Schema(description = \""));
LIST.add(Pair.with("@ApiModel(description","@Schema(description"));
LIST.add(Pair.with("format = DateFormat.custom","format = {}"));
LIST.add(Pair.with("import org.junit.Test;","import org.junit.jupiter.api.Test;"));
LIST.add(Pair.with("import org.junit.runner.RunWith;","import org.junit.jupiter.api.extension.ExtendWith;"));
LIST.add(Pair.with("import org.springframework.test.context.junit4.SpringRunner;","import org.springframework.test.context.junit.jupiter.SpringExtension;"));
LIST.add(Pair.with("@org.junit.Test","@org.junit.jupiter.api.Test"));
LIST.add(Pair.with("@RunWith(SpringRunner.class)","@ExtendWith(SpringExtension.class)"));
}
......
......@@ -21,6 +21,7 @@ public class XmlNormalUpdater extends NormalUpdater {
LIST.add(Pair.with("<maven.compiler.target>8</maven.compiler.target>", "<maven.compiler.target>17</maven.compiler.target>"));
LIST.add(Pair.with("<source>1.8</source>", "<source>17</source>"));
LIST.add(Pair.with("<target>1.8</target>", "<target>17</target>"));
LIST.add(Pair.with("<java.version>1.8</java.version>", "<java.version>17</java.version>"));
LIST.add(Pair.with("<groupId>javax.validation</groupId>", "<groupId>jakarta.validation</groupId>"));
LIST.add(Pair.with("<artifactId>validation-api</artifactId>", "<artifactId>jakarta.validation-api</artifactId>"));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论