use of org.apache.maven.model.PluginManagement in project pom-manipulation-ext by release-engineering.
the class Project method getResolvedProfileManagedPlugins.
/**
* This method will scan the plugins in the pluginManagement section in the potentially active Profiles
* in this project and return a fully resolved list. Note that while updating the {@link Plugin}
* reference returned will be reflected in the Model as it is the same object, if you wish to remove
* or add items to the Model then you must use {@link #getModel()}
*
* @param session MavenSessionHandler, used by {@link PropertyResolver}
* @return a list of fully resolved {@link ProjectVersionRef} to the original {@link Plugin}
* @throws ManipulationException if an error occurs
*/
public HashMap<Profile, HashMap<ProjectVersionRef, Plugin>> getResolvedProfileManagedPlugins(MavenSessionHandler session) throws ManipulationException {
if (resolvedProfileManagedPlugins == null) {
resolvedProfileManagedPlugins = new HashMap<>();
for (final Profile profile : ProfileUtils.getProfiles(session, model)) {
HashMap<ProjectVersionRef, Plugin> profileDeps = new HashMap<>();
if (profile.getBuild() != null) {
final PluginManagement pm = profile.getBuild().getPluginManagement();
if (!(pm == null || pm.getPlugins() == null)) {
resolvePlugins(session, pm.getPlugins(), profileDeps);
}
}
resolvedProfileManagedPlugins.put(profile, profileDeps);
}
}
return resolvedProfileManagedPlugins;
}
use of org.apache.maven.model.PluginManagement 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;
}
use of org.apache.maven.model.PluginManagement in project unleash-maven-plugin by shillner.
the class CheckPluginDependencyVersions method getSnapshotsFromManagement.
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshotsFromManagement(MavenProject project, PomPropertyResolver propertyResolver) {
this.log.debug("\t\tChecking managed plugins");
Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
Build build = project.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;
}
use of org.apache.maven.model.PluginManagement in project maven-plugins by apache.
the class CheckstyleViolationCheckMojo method collectArtifacts.
private List<Artifact> collectArtifacts(String hint) {
List<Artifact> artifacts = new ArrayList<>();
PluginManagement pluginManagement = project.getBuild().getPluginManagement();
if (pluginManagement != null) {
artifacts.addAll(getCheckstylePluginDependenciesAsArtifacts(pluginManagement.getPluginsAsMap(), hint));
}
artifacts.addAll(getCheckstylePluginDependenciesAsArtifacts(project.getBuild().getPluginsAsMap(), hint));
return artifacts;
}
use of org.apache.maven.model.PluginManagement in project maven-plugins by apache.
the class AbstractCheckstyleReport method collectArtifacts.
private List<Artifact> collectArtifacts(String hint) {
List<Artifact> artifacts = new ArrayList<>();
PluginManagement pluginManagement = project.getBuild().getPluginManagement();
if (pluginManagement != null) {
artifacts.addAll(getCheckstylePluginDependenciesAsArtifacts(pluginManagement.getPluginsAsMap(), hint));
}
artifacts.addAll(getCheckstylePluginDependenciesAsArtifacts(project.getBuild().getPluginsAsMap(), hint));
return artifacts;
}
Aggregations