use of org.jboss.galleon.maven.plugin.util.FeaturePackInstaller in project galleon by wildfly.
the class FeaturePackInstallMojo method execute.
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
getLog().info("Skipping the install-feature-pack goal.");
return;
}
FeaturePackLocation fpl = null;
Path localPath = null;
if (featurePack != null) {
localPath = resolveMaven(featurePack, new MavenArtifactRepositoryManager(repoSystem, repoSession));
} else if (location != null) {
fpl = FeaturePackLocation.fromString(location);
} else {
throw new MojoExecutionException("Either 'location' or 'feature-pack' must be configured");
}
final FeaturePackInstaller fpInstaller = FeaturePackInstaller.newInstance(repoSession.getLocalRepository().getBasedir().toPath(), installDir.toPath()).setFpl(fpl).setLocalArtifact(localPath).setInheritConfigs(inheritConfigs).includeConfigs(includedConfigs).setInheritPackages(inheritPackages).includePackages(includedPackages).excludePackages(excludedPackages).setPluginOptions(pluginOptions);
if (customConfig != null) {
fpInstaller.setCustomConfig(customConfig.toPath().toAbsolutePath());
}
final String originalMavenRepoLocal = System.getProperty(MAVEN_REPO_LOCAL);
System.setProperty(MAVEN_REPO_LOCAL, session.getSettings().getLocalRepository());
try {
fpInstaller.install();
} finally {
if (originalMavenRepoLocal == null) {
System.clearProperty(MAVEN_REPO_LOCAL);
} else {
System.setProperty(MAVEN_REPO_LOCAL, originalMavenRepoLocal);
}
}
}
Aggregations