Plugins: Allow to place "extracted" plugins under the `plugins` directory, closes #428.

This commit is contained in:
kimchy 2010-10-14 14:04:00 +02:00
parent 8d533e8a99
commit e0488fa87e
1 changed files with 17 additions and 0 deletions

View File

@ -164,6 +164,23 @@ public class PluginsService extends AbstractComponent {
File[] pluginsFiles = pluginsFile.listFiles(); File[] pluginsFiles = pluginsFile.listFiles();
for (File pluginFile : pluginsFiles) { for (File pluginFile : pluginsFiles) {
if (!pluginFile.getName().endsWith(".zip")) { if (!pluginFile.getName().endsWith(".zip")) {
if (pluginFile.isDirectory()) {
logger.trace("--- adding expanded plugin [" + pluginFile.getAbsolutePath() + "]");
try {
// add the root
addURL.invoke(classLoader, pluginFile.toURI().toURL());
// if there are jars in it, add it as well
for (File jarToAdd : pluginFile.listFiles()) {
if (!(jarToAdd.getName().endsWith(".jar") || jarToAdd.getName().endsWith(".zip"))) {
continue;
}
addURL.invoke(classLoader, jarToAdd.toURI().toURL());
}
} catch (Exception e) {
logger.warn("failed to add plugin [" + pluginFile + "]", e);
}
}
continue; continue;
} }
if (logger.isTraceEnabled()) { if (logger.isTraceEnabled()) {