diff --git a/README.md b/README.md index 9c2beee..f62f3b9 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,9 @@ idea导出增量补丁插件 把`patcher.jar`下载到`.IntelliJIDEAx0\config\plugins`目录,重启`Idea`,右击即可看到。 [原文](http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/deploying_plugin.html) +1、src的文件或文件夹导出时,直接导出对应的编译好的classes下的类 +2、其他的文件或文件夹导出时与在项目中的目录一致 +3、WEB-INFO/classes下的文件导出报错时,在moudle属性设置里把classes文件夹的Excluded属性去掉 + 操作如下: ![](patcher.gif) diff --git a/patcher.jar b/patcher.jar index 28d116a..7fb7e2a 100644 Binary files a/patcher.jar and b/patcher.jar differ diff --git a/src/PatcherDialog.form b/src/PatcherDialog.form index 3f6afa9..b8e384a 100644 --- a/src/PatcherDialog.form +++ b/src/PatcherDialog.form @@ -118,7 +118,7 @@ - + diff --git a/src/PatcherDialog.java b/src/PatcherDialog.java index 203d052..2816ba0 100644 --- a/src/PatcherDialog.java +++ b/src/PatcherDialog.java @@ -97,25 +97,34 @@ private void onOK() { String compilerOutputUrl = instance.getCompilerOutputPath().getPath(); // JavaWeb项目的WebRoot目录 String webPath = "/" + webTextField.getText() + "/"; + //项目模块的路径E:\git\moudlea\ + String modulePath = module.getModuleFilePath().split(".idea/")[0]; // 导出目录 String exportPath = textField.getText() + webPath; for (int i = 0; i < model.getSize(); i++) { VirtualFile element = model.getElementAt(i); String elementName = element.getName(); String elementPath = element.getPath(); - if (elementName.endsWith(".java")) { + if(elementPath.contains("/src/")){ + + //获取到src下的文件名或者目录名,如果是java文件则文件名由.java替换为.class并到编译路径下取,如果是文件夹则直接去编译路径下的文件夹 String className = File.separator + elementPath.split("/src/")[1].replace(".java", ".class"); File from = new File(compilerOutputUrl + className); File to = new File(exportPath + "WEB-INF" + File.separator + "classes" + className); - FileUtil.copy(from, to); - } else { + FileUtil.copyFileOrDir(from, to); + }else { File from = new File(elementPath); - File to = new File(exportPath + elementPath.split(webPath)[1]); - FileUtil.copy(from, to); + File to = null; + if(elementPath.contains(webPath)){ + to = new File(exportPath + elementPath.split(webPath)[1]); + }else{ + to = new File(textField.getText()+ File.separator+ elementPath.substring(modulePath.length())); + } + FileUtil.copyFileOrDir(from, to); } } } catch (Exception e) { - Messages.showErrorDialog(this, "Create Patcher Error!", "Error"); + Messages.showErrorDialog(this, "Create Patcher Error!"+e.getMessage(), "Error"); e.printStackTrace(); }