if (artifact != null) {
pluginList.getPlugin().add(toPluginType(Artifact.create(artifact)));
} else {
addDependencies(pluginList);
}
DownloadResults downloadPoller = new DownloadResults();
String targetServerPath = targetServerDirectory.getAbsolutePath();
Kernel kernel = new BasicKernel("Assembly", bundleContext);
PluginRepositoryList pluginRepoList = new PluginRepositoryDownloader(Collections.singletonMap(localRepo, (String[]) null), true);
try {
PluginInstallerGBean installer = new PluginInstallerGBean(targetRepositoryPath, targetServerPath, installedPluginsList, servers, pluginRepoList, kernel, bundleContext);
installer.install(pluginList, sourceRepo, true, null, null, downloadPoller);
if (overrides != null) {
for (Override override: this.overrides) {
AttributesType attributes = override.getOverrides(overridesDir);
installer.mergeOverrides(override.getServer(), attributes);
}
}
} catch (Exception e) {
throw new MojoExecutionException("Could not use plugin installer bean", e);
} finally {
kernel.shutdown();
try {
bundleContext.getBundle().stop();
} catch (BundleException e) {
// ignore
}
}
getLog().info("Installed plugins: ");
for (Artifact artifact: downloadPoller.getInstalledConfigIDs()) {
getLog().info(" " + artifact);
}
getLog().info("Installed dependencies: ");
for (Artifact artifact: downloadPoller.getDependenciesInstalled()) {
getLog().info(" " + artifact);
}
if (downloadPoller.isFailed()) {
throw new MojoExecutionException("Could not download all dependencies", downloadPoller.getFailure());
}
cleanup();
}