Fix class path in launcher command

You only need the deployer jar on the classpath (and the system classpath).
Nothing else matters and it can screw up the thin launcher classpath
if there are remnants of Guice or Guava or Aether.
This commit is contained in:
Dave Syer
2017-02-24 14:28:16 +00:00
parent 20233cfd19
commit e7519b9b8f

View File

@@ -179,13 +179,14 @@ public class LauncherCommand extends OptionParsingCommand {
AetherGrapeEngine grapeEngine = AetherGrapeEngineFactory.create(null,
repositoryConfiguration, resolutionContext);
HashMap<String, String> dependency = new HashMap<>();
HashMap<String, Object> dependency = new HashMap<>();
dependency.put("group", "org.springframework.cloud.launcher");
dependency.put("module", "spring-cloud-launcher-deployer");
dependency.put("version", getVersion());
dependency.put("transitive", false);
URI[] uris = grapeEngine.resolve(null, dependency);
URLClassLoader loader = new URLClassLoader(new URL[] { uris[0].toURL() },
getClass().getClassLoader().getParent());
getClass().getClassLoader().getParent().getParent());
log.debug("resolved URIs " + Arrays.asList(loader.getURLs()));
return loader;
}