diff --git a/src/main/java/org/elasticsearch/plugins/PluginManager.java b/src/main/java/org/elasticsearch/plugins/PluginManager.java index 89cf71e049b..5cd734e37d9 100644 --- a/src/main/java/org/elasticsearch/plugins/PluginManager.java +++ b/src/main/java/org/elasticsearch/plugins/PluginManager.java @@ -208,6 +208,14 @@ public class PluginManager { pluginFile.delete(); } + File binFile = new File(extractLocation, "bin"); + if (binFile.exists() && binFile.isDirectory()) { + File toLocation = new File(new File(environment.homeFile(), "bin"), name); + System.out.println("Found bin, moving to " + toLocation.getAbsolutePath()); + FileSystemUtils.deleteRecursively(toLocation); + binFile.renameTo(toLocation); + } + // try and identify the plugin type, see if it has no .class or .jar files in it // so its probably a _site, and it it does not have a _site in it, move everything to _site if (!new File(extractLocation, "_site").exists()) { @@ -233,6 +241,10 @@ public class PluginManager { if (pluginToDelete.exists()) { pluginToDelete.delete(); } + File binLocation = new File(new File(environment.homeFile(), "bin"), name); + if (binLocation.exists()) { + FileSystemUtils.deleteRecursively(binLocation); + } } public static void main(String[] args) { diff --git a/src/main/java/org/elasticsearch/plugins/PluginsService.java b/src/main/java/org/elasticsearch/plugins/PluginsService.java index b82d89112cb..fe699eabc5f 100644 --- a/src/main/java/org/elasticsearch/plugins/PluginsService.java +++ b/src/main/java/org/elasticsearch/plugins/PluginsService.java @@ -192,8 +192,16 @@ public class PluginsService extends AbstractComponent { try { // add the root addURL.invoke(classLoader, pluginFile.toURI().toURL()); + // gather files to add + List libFiles = Lists.newArrayList(); + libFiles.addAll(Arrays.asList(pluginsFile.listFiles())); + File libLocation = new File(pluginFile, "lib"); + if (libLocation.exists() && libLocation.isDirectory()) { + libFiles.addAll(Arrays.asList(libLocation.listFiles())); + } + // if there are jars in it, add it as well - for (File jarToAdd : pluginFile.listFiles()) { + for (File jarToAdd : libFiles) { if (!(jarToAdd.getName().endsWith(".jar") || jarToAdd.getName().endsWith(".zip"))) { continue; }