/** * Compares this plugin's identifying coordinates (i.e. not the version) to * those of the given plugin * * @param other the plugin being compared to (required) * @return see {@link Comparable#compareTo(Object)} */ private int compareCoordinates(final Plugin other) { Validate.notNull(other, "Plugin being compared to cannot be null"); int result = getGroupId().compareTo(other.getGroupId()); if (result == 0) { result = getArtifactId().compareTo(other.getArtifactId()); } return result; }
/** * Returns any build plugins with the same groupId and artifactId as the * given plugin. This is useful for upgrade cases. * * @param plugin to locate (required; note the version number is ignored in * comparisons) * @return any matching plugins (never returns null, but may return an empty * {@link Set}) */ public Set<Plugin> getBuildPluginsExcludingVersion(final Plugin plugin) { Validate.notNull(plugin, "Plugin to locate is required"); final Set<Plugin> result = new HashSet<Plugin>(); for (final Plugin p : buildPlugins) { if (plugin.getArtifactId().equals(p.getArtifactId()) && plugin.getGroupId().equals(p.getGroupId())) { result.add(p); } } return result; }
/** * Indicates whether the given plugin is registered in pluginManagement without checking plugin version * , by checking the result of {@link Plugin#equals(Object)}. * * @param plugin * the plugin to check (can be <code>null</code>) * @return <code>false</code> if a <code>null</code> dependency is given */ public boolean isPluginRegisteredInPluginManagement(final Plugin plugin, boolean checkVersion) { if (checkVersion) { return plugin != null && pluginsInPluginManagement.contains(plugin); } boolean registered = false; Iterator<Plugin> it = pluginsInPluginManagement.iterator(); while (it.hasNext()) { Plugin dp = it.next(); if (plugin.getGroupId().equals(dp.getGroupId()) && plugin.getArtifactId().equals(dp.getArtifactId())) { registered = true; break; } } return plugin != null && registered; }
pluginElement.appendChild(XmlUtils.createTextElement(document, "groupId", getGroupId())); pluginElement.appendChild(XmlUtils.createTextElement(document, "artifactId", getArtifactId())); pluginElement.appendChild(XmlUtils.createTextElement(document, "version", getVersion()));
/** * Constructor from a POM-style XML element that defines a Maven <plugin>. * * @param plugin the XML element to parse (required) */ public Plugin(final Element plugin) { this(getGroupId(plugin), getArtifactId(plugin), getVersion(plugin), getConfiguration(plugin), getDependencies(plugin), getExecutions(plugin)); }
+ plugin.getVersion() + "']", pluginsElement)) { final Plugin candidatePlugin = new Plugin(candidate); if (candidatePlugin.getGroupId().equals(plugin.getGroupId())) {