in enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/RequirePluginVersions.java [600:632]
private Set<Plugin> getAllPlugins(MavenProject project, Lifecycle lifecycle)
throws PluginNotFoundException, LifecycleExecutionException {
getLog().debug("RequirePluginVersions.getAllPlugins:");
Set<Plugin> plugins = new HashSet<>();
// first, bind those associated with the packaging
Map<String, String> mappings = findMappingsForLifecycle(project, lifecycle);
for (Map.Entry<String, String> entry : mappings.entrySet()) {
getLog().debug(" lifecycleMapping = " + entry.getKey());
String pluginsForLifecycle = entry.getValue();
getLog().debug(" plugins = " + pluginsForLifecycle);
if (pluginsForLifecycle != null && !pluginsForLifecycle.isEmpty()) {
String pluginList[] = pluginsForLifecycle.split(",");
for (String plugin : pluginList) {
plugin = StringUtils.strip(plugin);
getLog().debug(" plugin = " + plugin);
String tokens[] = plugin.split(":");
getLog().debug(" GAV = " + Arrays.asList(tokens));
Plugin p = new Plugin();
p.setGroupId(tokens[0]);
p.setArtifactId(tokens[1]);
plugins.add(p);
}
}
}
plugins.addAll(project.getBuildPlugins());
return plugins;
}