mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-10-31 18:49:06 +08:00 
			
		
		
		
	更改 文件过滤方法,适应windows
This commit is contained in:
		| @ -9,6 +9,7 @@ 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 等 | ||||
| @ -40,7 +41,7 @@ public class ProjectReactor { | ||||
|         // 获得需要复制的文件 | ||||
|         log.info("[main][开始获得需要重写的文件]"); | ||||
|         Collection<File> files = listFiles(projectBaseDir); | ||||
|         log.info("[main][需要重写的文件数量:{},预计需要 30 秒]", files.size()); | ||||
|         log.info("[main][需要重写的文件数量:{},预计需要 5-10 秒]", files.size()); | ||||
|         // 写入文件 | ||||
|         files.forEach(file -> { | ||||
|             String content = replaceFileContent(file, groupIdNew, artifactIdNew, packageNameNew, titleNew); | ||||
| @ -56,12 +57,15 @@ public class ProjectReactor { | ||||
|  | ||||
|     private static Collection<File> listFiles(String projectBaseDir) { | ||||
|         Collection<File> files = FileUtils.listFiles(new File(projectBaseDir), null, true); | ||||
|         files.removeIf(file -> file.getPath().contains("/target/")); | ||||
|         files.removeIf(file -> file.getPath().contains("/node_modules/")); | ||||
|         files.removeIf(file -> file.getPath().contains("/.idea/")); // 移除 IDEA 自身的文件 | ||||
|         files.removeIf(file -> file.getPath().contains("/.git/")); // 移除 Git 自身的文件 | ||||
|         files.removeIf(file -> file.getPath().contains("/.github/")); // 移除 GitHub 自身的文件 | ||||
|         files.removeIf(file -> file.getPath().contains("/dist/")); // 移除 Node 编译出来的 | ||||
|         // 移除 IDEA  Git GitHub 自身的文件; Node 编译出来的文件 | ||||
|         files = files.stream() | ||||
|                 .filter(file -> !file.getPath().contains("\\target\\") | ||||
|                         && !file.getPath().contains("\\node_modules\\") | ||||
|                         && !file.getPath().contains("\\.idea\\") | ||||
|                         && !file.getPath().contains("\\.git\\") | ||||
|                         && !file.getPath().contains("\\.github\\") | ||||
|                         && !file.getPath().contains("\\dist\\")) | ||||
|                 .collect(Collectors.toList()); | ||||
|         return files; | ||||
|     } | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 zhoulc
					zhoulc