You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/08/16 20:32:20 UTC
[maven-enforcer] 01/04: Added some debugging output.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch MENFORCER-306
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git
commit 6c1358fcd7c180e2f21eb01073e70f14c27d591b
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Tue Jun 19 17:58:07 2018 +0200
Added some debugging output.
---
.../plugins/enforcer/RequirePluginVersions.java | 62 +++++++++++++---------
1 file changed, 38 insertions(+), 24 deletions(-)
diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
index 9e840da..07bc4e5 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
@@ -80,7 +80,7 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
public class RequirePluginVersions
extends AbstractNonCacheableEnforcerRule
{
-
+
private EnforcerRuleHelper helper;
/**
@@ -235,6 +235,12 @@ public class RequirePluginVersions
allPlugins =
removeUncheckedPlugins( combineUncheckedPlugins( unCheckedPlugins, unCheckedPluginList ), allPlugins );
+ for ( Plugin plugin : allPlugins )
+ {
+ log.debug( "allPlugins(): " + plugin.getGroupId() + ":" + plugin.getArtifactId() + ":"
+ + plugin.getVersion() );
+ }
+
// there's nothing to do here
if ( allPlugins.isEmpty() )
{
@@ -249,12 +255,19 @@ public class RequirePluginVersions
// get all the plugins that are mentioned in the pom (and parents)
List<PluginWrapper> pluginWrappers = getAllPluginEntries( project );
+ for ( PluginWrapper pluginWrapper : pluginWrappers )
+ {
+ log.debug( "pluginWrappers: " + pluginWrapper.getGroupId() + ":" + pluginWrapper.getArtifactId() + ":"
+ + pluginWrapper.getVersion() + " source:" + pluginWrapper.getSource() );
+ }
// now look for the versions that aren't valid and add to a list.
List<Plugin> failures = new ArrayList<Plugin>();
for ( Plugin plugin : allPlugins )
{
if ( !hasValidVersionSpecified( helper, plugin, pluginWrappers ) )
{
+ log.debug( "hasValidVersionSpecified(): " + plugin.getGroupId() + ":" + plugin.getArtifactId() + ":"
+ + plugin.getVersion() );
failures.add( plugin );
}
}
@@ -392,7 +405,8 @@ public class RequirePluginVersions
* @return List of unchecked plugins.
*/
// CHECKSTYLE_OFF: LineLength
- public Collection<String> combineUncheckedPlugins( Collection<String> uncheckedPlugins, String uncheckedPluginsList )
+ public Collection<String> combineUncheckedPlugins( Collection<String> uncheckedPlugins,
+ String uncheckedPluginsList )
// CHECKSTYLE_ON: LineLength
{
// if the comma list is empty, then there's nothing to do here.
@@ -546,9 +560,8 @@ public class RequirePluginVersions
{
List<ArtifactRepository> pluginRepositories = project.getPluginArtifactRepositories();
- Artifact artifact =
- factory.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(),
- VersionRange.createFromVersion( "LATEST" ) );
+ Artifact artifact = factory.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(),
+ VersionRange.createFromVersion( "LATEST" ) );
try
{
@@ -557,11 +570,11 @@ public class RequirePluginVersions
}
catch ( ArtifactResolutionException e )
{
- //What does this mean?
+ // What does this mean?
}
catch ( ArtifactNotFoundException e )
{
- //What does this mean?
+ // What does this mean?
}
return plugin;
@@ -595,6 +608,8 @@ public class RequirePluginVersions
try
{
Lifecycle lifecycle = getLifecycleForPhase( lifecyclePhase );
+ log.debug( "getBoundPlugins(): " + project.getId() + " " + lifecyclePhase + " "
+ + lifecycle.getId() );
allPlugins.addAll( getAllPlugins( project, lifecycle ) );
}
catch ( BuildFailureException e )
@@ -783,6 +798,7 @@ public class RequirePluginVersions
List<String> phases = lifecycle.getPhases();
for ( String phase : phases )
{
+ log.debug( "getPhaseToLifecycleMap(): phase: " + phase );
if ( phaseToLifecycleMap.containsKey( phase ) )
{
Lifecycle prevLifecycle = (Lifecycle) phaseToLifecycleMap.get( phase );
@@ -835,9 +851,8 @@ public class RequirePluginVersions
String packaging = project.getPackaging();
Map<String, String> mappings = null;
- LifecycleMapping m =
- (LifecycleMapping) findExtension( project, LifecycleMapping.ROLE, packaging, session.getSettings(),
- session.getLocalRepository() );
+ LifecycleMapping m = (LifecycleMapping) findExtension( project, LifecycleMapping.ROLE, packaging,
+ session.getSettings(), session.getLocalRepository() );
if ( m != null )
{
mappings = m.getPhases( lifecycle.getId() );
@@ -856,8 +871,8 @@ public class RequirePluginVersions
{
if ( defaultMappings == null )
{
- throw new LifecycleExecutionException( "Cannot find lifecycle mapping for packaging: \'"
- + packaging + "\'.", e );
+ throw new LifecycleExecutionException( "Cannot find lifecycle mapping for packaging: \'" + packaging
+ + "\'.", e );
}
}
}
@@ -893,9 +908,8 @@ public class RequirePluginVersions
String packaging = project.getPackaging();
List<String> optionalMojos = null;
- LifecycleMapping m =
- (LifecycleMapping) findExtension( project, LifecycleMapping.ROLE, packaging, session.getSettings(),
- session.getLocalRepository() );
+ LifecycleMapping m = (LifecycleMapping) findExtension( project, LifecycleMapping.ROLE, packaging,
+ session.getSettings(), session.getLocalRepository() );
if ( m != null )
{
@@ -912,7 +926,7 @@ public class RequirePluginVersions
catch ( ComponentLookupException e )
{
log.debug( "Error looking up lifecycle mapping to retrieve optional mojos. Lifecycle ID: "
- + lifecycle.getId() + ". Error: " + e.getMessage(), e );
+ + lifecycle.getId() + ". Error: " + e.getMessage(), e );
}
}
@@ -1046,13 +1060,13 @@ public class RequirePluginVersions
// get all the pom models
List<Model> models = new ArrayList<Model>();
-
+
List<MavenProject> sortedProjects = session.getProjectDependencyGraph().getSortedProjects();
for ( MavenProject mavenProject : sortedProjects )
{
models.add( mavenProject.getOriginalModel() );
}
-
+
// now find all the plugin entries, either in
// build.plugins or build.pluginManagement.plugins, profiles.plugins and reporting
for ( Model model : models )
@@ -1060,8 +1074,8 @@ public class RequirePluginVersions
try
{
List<Plugin> modelPlugins = model.getBuild().getPlugins();
- plugins.addAll( PluginWrapper.addAll( utils.resolvePlugins( modelPlugins ), model.getId()
- + ".build.plugins" ) );
+ plugins.addAll( PluginWrapper.addAll( utils.resolvePlugins( modelPlugins ),
+ model.getId() + ".build.plugins" ) );
}
catch ( NullPointerException e )
{
@@ -1072,8 +1086,8 @@ public class RequirePluginVersions
{
List<ReportPlugin> modelReportPlugins = model.getReporting().getPlugins();
// add the reporting plugins
- plugins.addAll( PluginWrapper.addAll( utils.resolveReportPlugins( modelReportPlugins ), model.getId()
- + ".reporting" ) );
+ plugins.addAll( PluginWrapper.addAll( utils.resolveReportPlugins( modelReportPlugins ),
+ model.getId() + ".reporting" ) );
}
catch ( NullPointerException e )
{
@@ -1083,8 +1097,8 @@ public class RequirePluginVersions
try
{
List<Plugin> modelPlugins = model.getBuild().getPluginManagement().getPlugins();
- plugins.addAll( PluginWrapper.addAll( utils.resolvePlugins( modelPlugins ), model.getId()
- + ".build.pluginManagement.plugins" ) );
+ plugins.addAll( PluginWrapper.addAll( utils.resolvePlugins( modelPlugins ),
+ model.getId() + ".build.pluginManagement.plugins" ) );
}
catch ( NullPointerException e )
{