diff --git a/core/src/main/java/hudson/PluginWrapper.java b/core/src/main/java/hudson/PluginWrapper.java index f2a43f25a0..248fe9d02f 100644 --- a/core/src/main/java/hudson/PluginWrapper.java +++ b/core/src/main/java/hudson/PluginWrapper.java @@ -133,24 +133,8 @@ public final class PluginWrapper { List paths = new ArrayList(); if(isLinked) { - String classPath = manifest.getMainAttributes().getValue("Class-Path"); - for (String s : classPath.split(" +")) { - File file = resolve(archive, s); - if(file.getName().contains("*")) { - // handle wildcard - FileSet fs = new FileSet(); - File dir = file.getParentFile(); - fs.setDir(dir); - fs.setIncludes(file.getName()); - for( String included : fs.getDirectoryScanner(new Project()).getIncludedFiles() ) { - paths.add(new File(dir,included).toURL()); - } - } else { - if(!file.exists()) - throw new IOException("No such file: "+file); - paths.add(file.toURL()); - } - } + parseClassPath(archive, paths, "Libraries", ","); + parseClassPath(archive, paths, "Class-Path", " +"); // backward compatibility this.baseResourceURL = resolve(archive, manifest.getMainAttributes().getValue("Resource-Path")).toURL(); @@ -215,6 +199,27 @@ public final class PluginWrapper { } } + private void parseClassPath(File archive, List paths, String attributeName, String separator) throws IOException { + String classPath = manifest.getMainAttributes().getValue(attributeName); + for (String s : classPath.split(separator)) { + File file = resolve(archive, s); + if(file.getName().contains("*")) { + // handle wildcard + FileSet fs = new FileSet(); + File dir = file.getParentFile(); + fs.setDir(dir); + fs.setIncludes(file.getName()); + for( String included : fs.getDirectoryScanner(new Project()).getIncludedFiles() ) { + paths.add(new File(dir,included).toURL()); + } + } else { + if(!file.exists()) + throw new IOException("No such file: "+file); + paths.add(file.toURL()); + } + } + } + private static File resolve(File base, String relative) { File rel = new File(relative); if(rel.isAbsolute())