diff --git a/yudao-server/src/test/java/cn/iocoder/yudao/ProjectReactor.java b/yudao-server/src/test/java/cn/iocoder/yudao/ProjectReactor.java index f961b066f..0961c9252 100644 --- a/yudao-server/src/test/java/cn/iocoder/yudao/ProjectReactor.java +++ b/yudao-server/src/test/java/cn/iocoder/yudao/ProjectReactor.java @@ -8,10 +8,12 @@ import org.apache.commons.io.FileUtils; import java.io.File; import java.nio.charset.StandardCharsets; import java.util.Collection; +import java.util.regex.Matcher; +import java.util.stream.Collectors; /** * 项目修改器,一键替换 Maven 的 groupId、artifactId,项目的 package 等 - * + *
* 通过修改 groupIdNew、artifactIdNew、projectBaseDirNew 三个变量
*
* @author 芋道源码
@@ -25,6 +27,7 @@ public class ProjectReactor {
private static final String TITLE = "芋道管理系统";
public static void main(String[] args) {
+ long start = System.currentTimeMillis();
String projectBaseDir = getProjectBaseDir();
// ========== 配置,需要你手动修改 ==========
@@ -33,7 +36,7 @@ public class ProjectReactor {
String packageNameNew = "cn.start.pp";
String titleNew = "土豆管理系统";
String projectBaseDirNew = projectBaseDir + "-new"; // 一键改名后,“新”项目所在的目录
- // ========== ==========
+ log.info("[main][新项目路径地址]projectBaseDirNew: " + projectBaseDirNew);
// 获得需要复制的文件
log.info("[main][开始获得需要重写的文件]");
@@ -44,22 +47,26 @@ public class ProjectReactor {
String content = replaceFileContent(file, groupIdNew, artifactIdNew, packageNameNew, titleNew);
writeFile(file, content, projectBaseDir, projectBaseDirNew, packageNameNew, artifactIdNew);
});
- log.info("[main][重写完成]");
+ log.info("[main][重写完成]共耗时:{} 秒", (System.currentTimeMillis() - start) / 1000);
}
private static String getProjectBaseDir() {
- // noinspection ConstantConditions
- return StrUtil.subBefore(ProjectReactor.class.getClassLoader().getResource("").getFile(),
- "/yudao-server", false);
+ return StrUtil.subBefore(new File(ProjectReactor.class.getClassLoader().getResource(File.separator).getFile()).getPath(), File.separator + "yudao-server", false);
}
private static Collection