use of org.apache.maven.model.PluginManagement in project unleash-maven-plugin by shillner.
the class CheckPluginVersions method getSnapshotsFromManagement.
private Set<ArtifactCoordinates> getSnapshotsFromManagement(MavenProject project, PomPropertyResolver propertyResolver) {
this.log.debug("\t\tChecking managed plugins");
Build build = project.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();
}
use of org.apache.maven.model.PluginManagement 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();
}
use of org.apache.maven.model.PluginManagement in project pom-manipulation-ext by release-engineering.
the class DistributionEnforcingManipulator method getManagedPluginMap.
private Map<String, Plugin> getManagedPluginMap(final ModelBase base) {
if (base instanceof Model) {
final Build build = ((Model) base).getBuild();
if (build == null) {
return Collections.emptyMap();
}
final PluginManagement pm = build.getPluginManagement();
if (pm == null) {
return Collections.emptyMap();
}
final Map<String, Plugin> result = pm.getPluginsAsMap();
if (result == null) {
return Collections.emptyMap();
}
return result;
}
return Collections.emptyMap();
}
use of org.apache.maven.model.PluginManagement in project pom-manipulation-ext by release-engineering.
the class PluginManipulator method apply.
private void apply(final Project project, final Model model, PluginType type, final Set<Plugin> override) throws ManipulationException {
logger.info("Applying plugin changes for {} to: {} ", type, ga(project));
if (project.isInheritanceRoot()) {
// If the model doesn't have any plugin management set by default, create one for it
Build build = model.getBuild();
if (build == null) {
build = new Build();
model.setBuild(build);
logger.debug("Created new Build for model " + model.getId());
}
PluginManagement pluginManagement = model.getBuild().getPluginManagement();
if (pluginManagement == null) {
pluginManagement = new PluginManagement();
model.getBuild().setPluginManagement(pluginManagement);
logger.debug("Created new Plugin Management for model " + model.getId());
}
// Override plugin management versions
applyOverrides(project, type, PluginType.LocalPM, project.getResolvedManagedPlugins(session), override);
}
applyOverrides(project, type, PluginType.LocalP, project.getResolvedPlugins(session), override);
final HashMap<Profile, HashMap<ProjectVersionRef, Plugin>> pd = project.getResolvedProfilePlugins(session);
final HashMap<Profile, HashMap<ProjectVersionRef, Plugin>> pmd = project.getResolvedProfileManagedPlugins(session);
logger.debug("Processing profiles with plugin management");
for (Profile p : pmd.keySet()) {
applyOverrides(project, type, PluginType.LocalPM, pmd.get(p), override);
}
logger.debug("Processing profiles with plugins");
for (Profile p : pd.keySet()) {
applyOverrides(project, type, PluginType.LocalP, pd.get(p), override);
}
}
use of org.apache.maven.model.PluginManagement in project maven-plugins by apache.
the class ProjectInfoProjectStub method getPluginManagement.
@Override
public PluginManagement getPluginManagement() {
PluginManagement pluginMgmt = null;
Build build = model.getBuild();
if (build != null) {
pluginMgmt = build.getPluginManagement();
}
return pluginMgmt;
}
Aggregations