MNG-2823 Silencing some annoying logging

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@522696 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2007-03-27 01:16:03 +00:00
parent dddd69dac1
commit 2e719998ac
2 changed files with 14 additions and 10 deletions

View File

@ -23,6 +23,9 @@ import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.artifact.versioning.VersionRange;
import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.logging.Logger;
import java.util.Set;
import java.util.HashSet;
/** /**
* Send resolution events to the debug log. * Send resolution events to the debug log.
* *
@ -36,6 +39,8 @@ public class DebugResolutionListener
private String indent = ""; private String indent = "";
private static Set ignoredArtifacts = new HashSet();
public DebugResolutionListener( Logger logger ) public DebugResolutionListener( Logger logger )
{ {
this.logger = logger; this.logger = logger;
@ -74,6 +79,15 @@ public class DebugResolutionListener
{ {
logger.debug( indent + artifact + " (not setting scope to: " + scope + "; local scope " + artifact.getScope() + logger.debug( indent + artifact + " (not setting scope to: " + scope + "; local scope " + artifact.getScope() +
" wins)" ); " wins)" );
// TODO: better way than static? this might hide messages in a reactor
if ( !ignoredArtifacts.contains( artifact ) )
{
logger.warn( "\n\tArtifact " + artifact + " retains local scope '" + artifact.getScope() +
"' overriding broader scope '" + scope + "'\n" +
"\tgiven by a dependency. If this is not intended, modify or remove the local scope.\n" );
ignoredArtifacts.add( artifact );
}
} }
public void updateScope( Artifact artifact, String scope ) public void updateScope( Artifact artifact, String scope )

View File

@ -37,8 +37,6 @@ public class WarningResolutionListener
{ {
private Logger logger; private Logger logger;
private static Set ignoredArtifacts = new HashSet();
public WarningResolutionListener( Logger logger ) public WarningResolutionListener( Logger logger )
{ {
this.logger = logger; this.logger = logger;
@ -70,14 +68,6 @@ public class WarningResolutionListener
public void updateScopeCurrentPom( Artifact artifact, String scope ) public void updateScopeCurrentPom( Artifact artifact, String scope )
{ {
// TODO: better way than static? this might hide messages in a reactor
if ( !ignoredArtifacts.contains( artifact ) )
{
logger.warn( "\n\tArtifact " + artifact + " retains local scope '" + artifact.getScope() +
"' overriding broader scope '" + scope + "'\n" +
"\tgiven by a dependency. If this is not intended, modify or remove the local scope.\n" );
ignoredArtifacts.add( artifact );
}
} }
public void updateScope( Artifact artifact, String scope ) public void updateScope( Artifact artifact, String scope )