自动打包工具添加黑名单配置
parent
ed0263178f
commit
6593b3b59a
|
@ -31,7 +31,7 @@ public class BuilderPackageEcology extends Application {
|
|||
public void start(Stage primaryStage) {
|
||||
primaryStage.setTitle("EBU7部开发一部自动打包工具");
|
||||
|
||||
FileInfo fileInfo = FileTreeBuilder.buildFileTree("target/");
|
||||
FileInfo fileInfo = FileTreeBuilder.buildFileTree();
|
||||
rootItem = createTreeItem(fileInfo);
|
||||
|
||||
treeView = new TreeView<>(rootItem);
|
||||
|
|
|
@ -12,13 +12,9 @@ public class FileTreeBuilder {
|
|||
public static final String DIRECTORY_TYPE = "文件夹";
|
||||
public static final String FILE_TYPE = "文件";
|
||||
|
||||
public static FileInfo buildFileTree(String directoryPath) {
|
||||
File root = new File(directoryPath);
|
||||
if (!root.exists() || !root.isDirectory()) {
|
||||
System.out.println("Invalid directory path: " + directoryPath);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static FileInfo buildFileTree() {
|
||||
String directoryPath = "target/";
|
||||
List<String> blackList = new ArrayList<>();
|
||||
List<String> blacklistPrefixes = Arrays.asList(
|
||||
"target" + File.separator + "generated-sources",
|
||||
"target" + File.separator + "generated-test-sources",
|
||||
|
@ -29,8 +25,6 @@ public class FileTreeBuilder {
|
|||
"target" + File.separator + "classes" + File.separator + "cus_getlog"
|
||||
);
|
||||
Properties properties = new Properties();
|
||||
|
||||
List<String> blackList = new ArrayList<>();
|
||||
try (InputStream inputStream = FileTreeBuilder.class.getClassLoader().getResourceAsStream("application.properties")) {
|
||||
properties.load(inputStream);
|
||||
// 通过键获取属性值
|
||||
|
@ -39,12 +33,16 @@ public class FileTreeBuilder {
|
|||
String[] split = value.split(";");
|
||||
Collections.addAll(blackList, split);
|
||||
}
|
||||
directoryPath = properties.getProperty("packageRootPath");
|
||||
blackList.addAll(blacklistPrefixes);
|
||||
System.out.println("Value: " + value);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(blackList);
|
||||
File root = new File(directoryPath);
|
||||
if (!root.exists() || !root.isDirectory()) {
|
||||
System.out.println("Invalid directory path: " + directoryPath);
|
||||
return null;
|
||||
}
|
||||
return buildFileTreeRecursively(root, blackList);
|
||||
}
|
||||
|
||||
|
@ -124,9 +122,4 @@ public class FileTreeBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String directoryPath = "target/";
|
||||
FileInfo fileTree = buildFileTree(directoryPath);
|
||||
printFileTree(fileTree, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue