1 package org.apache.maven.artifact.resolver; 2 3 18 19 import org.apache.maven.artifact.Artifact; 20 import org.apache.maven.artifact.versioning.VersionRange; 21 import org.codehaus.plexus.logging.Logger; 22 23 29 public class DebugResolutionListener 30 implements ResolutionListener 31 { 32 private Logger logger; 33 34 private String indent = ""; 35 36 public DebugResolutionListener( Logger logger ) 37 { 38 this.logger = logger; 39 } 40 41 public void testArtifact( Artifact node ) 42 { 43 } 44 45 public void startProcessChildren( Artifact artifact ) 46 { 47 indent += " "; 48 } 49 50 public void endProcessChildren( Artifact artifact ) 51 { 52 indent = indent.substring( 2 ); 53 } 54 55 public void includeArtifact( Artifact artifact ) 56 { 57 logger.debug( indent + artifact + " (selected for " + artifact.getScope() + ")" ); 58 } 59 60 public void omitForNearer( Artifact omitted, Artifact kept ) 61 { 62 logger.debug( indent + omitted + " (removed - nearer found: " + kept.getVersion() + ")" ); 63 } 64 65 public void omitForCycle( Artifact omitted ) 66 { 67 logger.debug( indent + omitted + " (removed - causes a cycle in the graph)" ); 68 } 69 70 public void updateScopeCurrentPom( Artifact artifact, String scope ) 71 { 72 logger.debug( indent + artifact + " (not setting scope to: " + scope + "; local scope " + artifact.getScope() + 73 " wins)" ); 74 } 75 76 public void updateScope( Artifact artifact, String scope ) 77 { 78 logger.debug( indent + artifact + " (setting scope to: " + scope + ")" ); 79 } 80 81 public void selectVersionFromRange( Artifact artifact ) 82 { 83 logger.debug( indent + artifact + " (setting version to: " + artifact.getVersion() + " from range: " + 84 artifact.getVersionRange() + ")" ); 85 } 86 87 public void restrictRange( Artifact artifact, Artifact replacement, VersionRange newRange ) 88 { 89 logger.debug( indent + artifact + " (range restricted from: " + artifact.getVersionRange() + " and: " + 90 replacement.getVersionRange() + " to: " + newRange + " )" ); 91 } 92 93 public void manageArtifact( Artifact artifact, Artifact replacement ) 94 { 95 String msg = indent + artifact; 96 msg += " ("; 97 if ( replacement.getVersion() != null ) 98 { 99 msg += "applying version: " + replacement.getVersion() + ";"; 100 } 101 if ( replacement.getScope() != null ) 102 { 103 msg += "applying scope: " + replacement.getScope(); 104 } 105 msg += ")"; 106 logger.debug( msg ); 107 } 108 } 109 | Popular Tags |