Small re-org of PropertiesLauncher

This commit is contained in:
Dave Syer 2013-10-15 09:56:52 -04:00
parent 8a804f6185
commit d4d9ebcabd
5 changed files with 55 additions and 47 deletions

View File

@ -1,13 +1,13 @@
#Generated by Git-Commit-Id-Plugin
#Mon Oct 14 16:04:34 EDT 2013
git.commit.id.abbrev=b0c54a6
#Tue Oct 15 09:46:33 EDT 2013
git.commit.id.abbrev=be12635
git.commit.user.email=dsyer@gopivotal.com
git.commit.message.full=Add parent class loader entries if possible\n\n...otherwise you can see cryptic NoClassDefFound errors\nbecause the application class was loaded from the parent\non the file system, but then it doesn't have access to the\nchild loaders nested jars.\n
git.commit.id=b0c54a65885de569cc20d4a1fb59b5372c73adcc
git.commit.message.short=Add parent class loader entries if possible
git.commit.message.full=Ensure env vars are consulted for PATH\n
git.commit.id=be1263500df0c363ad45c0ccf387e4c06e6f5c7d
git.commit.message.short=Ensure env vars are consulted for PATH
git.commit.user.name=Dave Syer
git.build.user.name=Dave Syer
git.build.user.email=dsyer@gopivotal.com
git.branch=master
git.commit.time=2013-10-14T16\:02\:04-0400
git.build.time=2013-10-14T16\:04\:34-0400
git.commit.time=2013-10-14T16\:07\:50-0400
git.build.time=2013-10-15T09\:46\:33-0400

View File

@ -1,13 +1,13 @@
#Generated by Git-Commit-Id-Plugin
#Mon Oct 14 16:04:26 EDT 2013
git.commit.id.abbrev=b0c54a6
#Tue Oct 15 09:46:12 EDT 2013
git.commit.id.abbrev=be12635
git.commit.user.email=dsyer@gopivotal.com
git.commit.message.full=Add parent class loader entries if possible\n\n...otherwise you can see cryptic NoClassDefFound errors\nbecause the application class was loaded from the parent\non the file system, but then it doesn't have access to the\nchild loaders nested jars.\n
git.commit.id=b0c54a65885de569cc20d4a1fb59b5372c73adcc
git.commit.message.short=Add parent class loader entries if possible
git.commit.message.full=Ensure env vars are consulted for PATH\n
git.commit.id=be1263500df0c363ad45c0ccf387e4c06e6f5c7d
git.commit.message.short=Ensure env vars are consulted for PATH
git.commit.user.name=Dave Syer
git.build.user.name=Dave Syer
git.build.user.email=dsyer@gopivotal.com
git.branch=master
git.commit.time=2013-10-14T16\:02\:04-0400
git.build.time=2013-10-14T16\:04\:26-0400
git.commit.time=2013-10-14T16\:07\:50-0400
git.build.time=2013-10-15T09\:46\:12-0400

View File

@ -300,31 +300,39 @@ public class PropertiesLauncher extends Launcher {
protected List<Archive> getClassPathArchives() throws Exception {
List<Archive> lib = new ArrayList<Archive>();
for (String path : this.paths) {
String root = cleanupPath(stripFileUrlPrefix(path));
File file = new File(root);
if (!root.startsWith("/")) {
file = new File(this.home, root);
}
if (file.isDirectory()) {
this.logger.info("Adding classpath entries from " + path);
Archive archive = new ExplodedArchive(file);
lib.addAll(archive.getNestedArchives(new EntryFilter() {
@Override
public boolean matches(Entry entry) {
return entry.isDirectory() || entry.getName().endsWith(".jar")
|| entry.getName().endsWith(".zip");
}
}));
lib.add(0, archive);
}
else {
this.logger.info("No directory found at " + path);
for (Archive archive : getClassPathArchives(path)) {
List<Archive> nested = new ArrayList<Archive>(
archive.getNestedArchives(new EntryFilter() {
@Override
public boolean matches(Entry entry) {
return entry.isDirectory()
|| entry.getName().endsWith(".jar")
|| entry.getName().endsWith(".zip");
}
}));
nested.add(0, archive);
lib.addAll(nested);
}
}
addParentClassLoaderEntries(lib);
return lib;
}
private List<Archive> getClassPathArchives(String path) {
String root = cleanupPath(stripFileUrlPrefix(path));
List<Archive> lib = new ArrayList<Archive>();
File file = new File(root);
if (!root.startsWith("/")) {
file = new File(this.home, root);
}
if (file.isDirectory()) {
this.logger.info("Adding classpath entries from " + file);
Archive archive = new ExplodedArchive(file);
lib.add(archive);
}
return lib;
}
private void addParentClassLoaderEntries(List<Archive> lib) throws IOException,
URISyntaxException {
ClassLoader parentClassLoader = getClass().getClassLoader();

View File

@ -1,13 +1,13 @@
#Generated by Git-Commit-Id-Plugin
#Mon Oct 14 16:04:25 EDT 2013
git.commit.id.abbrev=b0c54a6
#Tue Oct 15 09:45:47 EDT 2013
git.commit.id.abbrev=be12635
git.commit.user.email=dsyer@gopivotal.com
git.commit.message.full=Add parent class loader entries if possible\n\n...otherwise you can see cryptic NoClassDefFound errors\nbecause the application class was loaded from the parent\non the file system, but then it doesn't have access to the\nchild loaders nested jars.\n
git.commit.id=b0c54a65885de569cc20d4a1fb59b5372c73adcc
git.commit.message.short=Add parent class loader entries if possible
git.commit.message.full=Ensure env vars are consulted for PATH\n
git.commit.id=be1263500df0c363ad45c0ccf387e4c06e6f5c7d
git.commit.message.short=Ensure env vars are consulted for PATH
git.commit.user.name=Dave Syer
git.build.user.name=Dave Syer
git.build.user.email=dsyer@gopivotal.com
git.branch=master
git.commit.time=2013-10-14T16\:02\:04-0400
git.build.time=2013-10-14T16\:04\:25-0400
git.commit.time=2013-10-14T16\:07\:50-0400
git.build.time=2013-10-15T09\:45\:47-0400

View File

@ -1,13 +1,13 @@
#Generated by Git-Commit-Id-Plugin
#Mon Oct 14 16:04:29 EDT 2013
git.commit.id.abbrev=b0c54a6
#Tue Oct 15 09:46:13 EDT 2013
git.commit.id.abbrev=be12635
git.commit.user.email=dsyer@gopivotal.com
git.commit.message.full=Add parent class loader entries if possible\n\n...otherwise you can see cryptic NoClassDefFound errors\nbecause the application class was loaded from the parent\non the file system, but then it doesn't have access to the\nchild loaders nested jars.\n
git.commit.id=b0c54a65885de569cc20d4a1fb59b5372c73adcc
git.commit.message.short=Add parent class loader entries if possible
git.commit.message.full=Ensure env vars are consulted for PATH\n
git.commit.id=be1263500df0c363ad45c0ccf387e4c06e6f5c7d
git.commit.message.short=Ensure env vars are consulted for PATH
git.commit.user.name=Dave Syer
git.build.user.name=Dave Syer
git.build.user.email=dsyer@gopivotal.com
git.branch=master
git.commit.time=2013-10-14T16\:02\:04-0400
git.build.time=2013-10-14T16\:04\:29-0400
git.commit.time=2013-10-14T16\:07\:50-0400
git.build.time=2013-10-15T09\:46\:13-0400