From 2e719998ace4d45ad3a3ad37870ceac2ab251ac9 Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Tue, 27 Mar 2007 01:16:03 +0000 Subject: [PATCH] MNG-2823 Silencing some annoying logging git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@522696 13f79535-47bb-0310-9956-ffa450edef68 --- .../artifact/resolver/DebugResolutionListener.java | 14 ++++++++++++++ .../resolver/WarningResolutionListener.java | 10 ---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java index ff8597c7e5..f5afccc469 100644 --- a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java +++ b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java @@ -23,6 +23,9 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.versioning.VersionRange; import org.codehaus.plexus.logging.Logger; +import java.util.Set; +import java.util.HashSet; + /** * Send resolution events to the debug log. * @@ -36,6 +39,8 @@ public class DebugResolutionListener private String indent = ""; + private static Set ignoredArtifacts = new HashSet(); + public DebugResolutionListener( 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() + " 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 ) diff --git a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java index d24b3356ed..916a4561e4 100644 --- a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java +++ b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java @@ -37,8 +37,6 @@ public class WarningResolutionListener { private Logger logger; - private static Set ignoredArtifacts = new HashSet(); - public WarningResolutionListener( Logger logger ) { this.logger = logger; @@ -70,14 +68,6 @@ public class WarningResolutionListener 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 )