diff --git a/src/test/java/BuilderPackageEcology.java b/src/test/java/BuilderPackageEcology.java index ae43a2c..760c550 100644 --- a/src/test/java/BuilderPackageEcology.java +++ b/src/test/java/BuilderPackageEcology.java @@ -55,7 +55,7 @@ public class BuilderPackageEcology extends Application { try { FileCompressor.compressFiles(filePaths, outputFile.getAbsolutePath(), path -> { String rootPath = Util.class.getResource("/").getPath(); - rootPath = rootPath.split(File.separator + "target" + File.separator)[0] + File.separator + "target" + File.separator + "classes" + File.separator; + rootPath = rootPath.split(File.separator + FileTreeBuilder.targetPath)[0] + File.separator + FileTreeBuilder.targetPath + "classes" + File.separator; String replace = "/ecology/" + (isEcology ? "WEB-INF/classes/" : "classbean/"); if (path.endsWith(".jar")) { replace = "/ecology/WEB-INF/lib/"; diff --git a/src/test/java/builderpackage/FileTreeBuilder.java b/src/test/java/builderpackage/FileTreeBuilder.java index dd12388..ee9dd68 100644 --- a/src/test/java/builderpackage/FileTreeBuilder.java +++ b/src/test/java/builderpackage/FileTreeBuilder.java @@ -12,6 +12,8 @@ public class FileTreeBuilder { public static final String DIRECTORY_TYPE = "文件夹"; public static final String FILE_TYPE = "文件"; + public static String targetPath; + public static FileInfo buildFileTree() { String directoryPath = "target"; List blackList = new ArrayList<>(); @@ -31,6 +33,7 @@ public class FileTreeBuilder { if (!directoryPath.endsWith(File.separator)) { directoryPath += File.separator; } + targetPath = directoryPath; } List blacklistPrefixes = Arrays.asList( directoryPath + "generated-sources",