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