Search in sources :

Example 1 with FeaturePackInstaller

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);
        }
    }
}
Also used : Path(java.nio.file.Path) FeaturePackInstaller(org.jboss.galleon.maven.plugin.util.FeaturePackInstaller) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MavenArtifactRepositoryManager(org.jboss.galleon.maven.plugin.util.MavenArtifactRepositoryManager) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Aggregations

Path (java.nio.file.Path)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 FeaturePackInstaller (org.jboss.galleon.maven.plugin.util.FeaturePackInstaller)1 MavenArtifactRepositoryManager (org.jboss.galleon.maven.plugin.util.MavenArtifactRepositoryManager)1 FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)1