Java Code Examples for org.apache.maven.model.PluginManagement#getPlugins()
The following examples show how to use
org.apache.maven.model.PluginManagement#getPlugins() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocationAwareMavenXpp3Writer.java From netbeans with Apache License 2.0 | 6 votes |
private void writePluginManagement(PluginManagement pluginManagement, String tagName, XmlSerializer serializer) throws java.io.IOException { serializer.startTag(NAMESPACE, tagName); flush(serializer); StringBuffer b = b(serializer); int start = b.length(); if ((pluginManagement.getPlugins() != null) && (pluginManagement.getPlugins().size() > 0)) { serializer.startTag(NAMESPACE, "plugins"); for (Iterator iter = pluginManagement.getPlugins().iterator(); iter.hasNext();) { Plugin o = (Plugin) iter.next(); writePlugin(o, "plugin", serializer); } serializer.endTag(NAMESPACE, "plugins"); } serializer.endTag(NAMESPACE, tagName).flush(); logLocation(pluginManagement, "", start, b.length()); }
Example 2
Source File: OverridePluginManagementError.java From netbeans with Apache License 2.0 | 6 votes |
private Map<String, String> collectManaged(Project prj) { NbMavenProject project = prj.getLookup().lookup(NbMavenProject.class); Map<String, String> toRet = new HashMap<String, String>(); if (project == null) { //#154462 return toRet; } PluginManagement pluginManagement = project.getMavenProject().getPluginManagement(); if (pluginManagement == null) { // #189404 return toRet; } for (org.apache.maven.model.Plugin plg : pluginManagement.getPlugins()) { if (plg.getGroupId().equals(Constants.GROUP_APACHE_PLUGINS)) { continue; // #189261 - might be from superpom } toRet.put(plg.getKey(), plg.getVersion()); } return toRet; }
Example 3
Source File: CheckPluginDependencyVersions.java From unleash-maven-plugin with Eclipse Public License 1.0 | 6 votes |
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; }
Example 4
Source File: CheckPluginDependencyVersions.java From unleash-maven-plugin with Eclipse Public License 1.0 | 6 votes |
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; }
Example 5
Source File: Project.java From pom-manipulation-ext with Apache License 2.0 | 6 votes |
/** * This method will scan the plugins in the pluginManagement section of 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 Map<ProjectVersionRef, Plugin> getResolvedManagedPlugins ( MavenSessionHandler session) throws ManipulationException { Map<ProjectVersionRef, Plugin> resolvedManagedPlugins = new HashMap<>(); if ( getModel().getBuild() != null ) { final PluginManagement pm = getModel().getBuild().getPluginManagement(); if ( !( pm == null || pm.getPlugins() == null ) ) { resolvePlugins( session, pm.getPlugins(), PluginResolver.PLUGIN_DEFAULTS, resolvedManagedPlugins ); } } return resolvedManagedPlugins; }
Example 6
Source File: GenerateBomMojo.java From sundrio with Apache License 2.0 | 5 votes |
/** * Returns all dependencies defined in dependency management of the root pom. * * @return */ private Set<Artifact> getProjectPluginManagement() { Set<Artifact> result = new LinkedHashSet<Artifact>(); PluginManagement pluginManagement = getProject().getPluginManagement(); if (pluginManagement != null) { for (Plugin plugin : pluginManagement.getPlugins()) { result.add(toArtifact(plugin)); } } return result; }