Search in sources :

Example 1 with BuildBase

use of org.apache.maven.model.BuildBase in project unleash-maven-plugin by shillner.

the class CheckPluginVersions method getSnapshotsFromManagement.

private Set<ArtifactCoordinates> getSnapshotsFromManagement(Profile profile, PomPropertyResolver propertyResolver) {
    this.log.debug("\t\tChecking managed plugins of profile '" + profile.getId() + "'");
    BuildBase build = profile.getBuild();
    if (build != null) {
        PluginManagement pluginManagement = build.getPluginManagement();
        if (pluginManagement != null) {
            Collection<Plugin> snapshots = Collections2.filter(pluginManagement.getPlugins(), new IsSnapshotPlugin(propertyResolver));
            return Sets.newHashSet(Collections2.transform(snapshots, PluginToCoordinates.INSTANCE));
        }
    }
    return Collections.emptySet();
}
Also used : PluginManagement(org.apache.maven.model.PluginManagement) BuildBase(org.apache.maven.model.BuildBase) IsSnapshotPlugin(com.itemis.maven.plugins.unleash.util.predicates.IsSnapshotPlugin) IsSnapshotPlugin(com.itemis.maven.plugins.unleash.util.predicates.IsSnapshotPlugin) Plugin(org.apache.maven.model.Plugin)

Example 2 with BuildBase

use of org.apache.maven.model.BuildBase in project pom-manipulation-ext by release-engineering.

the class DistributionEnforcingManipulatorTest method assertSkip.

private void assertSkip(final Model model, final String profileId, final boolean deploy, final boolean state) {
    BuildBase build = null;
    if (profileId != null) {
        final List<Profile> profiles = model.getProfiles();
        if (profiles != null) {
            for (final Profile profile : profiles) {
                if (profileId.equals(profile.getId())) {
                    build = profile.getBuild();
                }
            }
        }
    } else {
        build = model.getBuild();
    }
    assertThat(build, notNullValue());
    final Plugin plugin = build.getPluginsAsMap().get(ga(MAVEN_PLUGIN_GROUPID, deploy ? MAVEN_DEPLOY_ARTIFACTID : MAVEN_INSTALL_ARTIFACTID));
    assertThat(plugin, notNullValue());
    assertThat(plugin.getConfiguration().toString().contains("<skip>" + state + "</skip>"), equalTo(true));
}
Also used : BuildBase(org.apache.maven.model.BuildBase) Profile(org.apache.maven.model.Profile) Plugin(org.apache.maven.model.Plugin)

Example 3 with BuildBase

use of org.apache.maven.model.BuildBase in project pom-manipulation-ext by release-engineering.

the class DistributionEnforcingManipulator method getPluginMap.

private Map<String, Plugin> getPluginMap(final ModelBase base) {
    final BuildBase build;
    if (base instanceof Model) {
        build = ((Model) base).getBuild();
    } else {
        build = ((Profile) base).getBuild();
    }
    if (build == null) {
        return Collections.emptyMap();
    }
    final Map<String, Plugin> result = build.getPluginsAsMap();
    if (result == null) {
        return Collections.emptyMap();
    }
    return result;
}
Also used : BuildBase(org.apache.maven.model.BuildBase) Model(org.apache.maven.model.Model) Plugin(org.apache.maven.model.Plugin)

Example 4 with BuildBase

use of org.apache.maven.model.BuildBase in project unleash-maven-plugin by shillner.

the class CheckPluginDependencyVersions method getSnapshotsFromManagement.

private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshotsFromManagement(Profile profile, PomPropertyResolver propertyResolver) {
    this.log.debug("\t\tChecking managed plugins of profile '" + profile.getId() + "'");
    Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
    BuildBase build = profile.getBuild();
    if (build != null) {
        PluginManagement pluginManagement = build.getPluginManagement();
        if (pluginManagement != null) {
            for (Plugin plugin : pluginManagement.getPlugins()) {
                Collection<Dependency> snapshots = Collections2.filter(plugin.getDependencies(), new IsSnapshotDependency(propertyResolver));
                if (!snapshots.isEmpty()) {
                    result.putAll(PluginToCoordinates.INSTANCE.apply(plugin), Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
                }
            }
        }
    }
    return result;
}
Also used : PluginManagement(org.apache.maven.model.PluginManagement) BuildBase(org.apache.maven.model.BuildBase) IsSnapshotDependency(com.itemis.maven.plugins.unleash.util.predicates.IsSnapshotDependency) ArtifactCoordinates(com.itemis.maven.aether.ArtifactCoordinates) Dependency(org.apache.maven.model.Dependency) IsSnapshotDependency(com.itemis.maven.plugins.unleash.util.predicates.IsSnapshotDependency) Plugin(org.apache.maven.model.Plugin)

Example 5 with BuildBase

use of org.apache.maven.model.BuildBase in project unleash-maven-plugin by shillner.

the class CheckPluginDependencyVersions method getSnapshots.

private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshots(Profile profile, PomPropertyResolver propertyResolver) {
    this.log.debug("\t\tChecking direct plugin references of profile '" + profile.getId() + "'");
    Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
    BuildBase build = profile.getBuild();
    if (build != null) {
        for (Plugin plugin : build.getPlugins()) {
            Collection<Dependency> snapshots = Collections2.filter(plugin.getDependencies(), new IsSnapshotDependency(propertyResolver));
            if (!snapshots.isEmpty()) {
                result.putAll(PluginToCoordinates.INSTANCE.apply(plugin), Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
            }
        }
    }
    return result;
}
Also used : BuildBase(org.apache.maven.model.BuildBase) IsSnapshotDependency(com.itemis.maven.plugins.unleash.util.predicates.IsSnapshotDependency) ArtifactCoordinates(com.itemis.maven.aether.ArtifactCoordinates) Dependency(org.apache.maven.model.Dependency) IsSnapshotDependency(com.itemis.maven.plugins.unleash.util.predicates.IsSnapshotDependency) Plugin(org.apache.maven.model.Plugin)

Aggregations

BuildBase (org.apache.maven.model.BuildBase)6 Plugin (org.apache.maven.model.Plugin)6 ArtifactCoordinates (com.itemis.maven.aether.ArtifactCoordinates)2 IsSnapshotDependency (com.itemis.maven.plugins.unleash.util.predicates.IsSnapshotDependency)2 IsSnapshotPlugin (com.itemis.maven.plugins.unleash.util.predicates.IsSnapshotPlugin)2 Dependency (org.apache.maven.model.Dependency)2 PluginManagement (org.apache.maven.model.PluginManagement)2 Model (org.apache.maven.model.Model)1 Profile (org.apache.maven.model.Profile)1