Author: dantran
Date: Thu Dec 31 03:01:10 2009
New Revision: 894772

URL: http://svn.apache.org/viewvc?rev=894772&view=rev
Log:
MDEP-191: Tidy up logging from unpack, submitted by Tom Palmer

Modified:
    
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java

Modified: 
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java?rev=894772&r1=894771&r2=894772&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java
 Thu Dec 31 03:01:10 2009
@@ -219,9 +219,7 @@
     {
         try
         {
-            getLog().info(
-                            "Unpacking " + file.getPath() + " to\n  " + 
location.getPath()
-                                + "\n   with includes " + includes + " and 
excludes:" + excludes );
+            logUnpack( file, location, includes, excludes );
 
             location.mkdirs();
 
@@ -404,4 +402,38 @@
     {
         this.artifactMetadataSource = theArtifactMetadataSource;
     }
+
+    private void logUnpack( File file, File location, String includes, String 
excludes )
+    {
+        if ( !getLog().isInfoEnabled() )
+        {
+            return;
+        }
+
+        StringBuffer msg = new StringBuffer();
+        msg.append( "Unpacking " );
+        msg.append( file );
+        msg.append( " to " );
+        msg.append( location );
+
+        if ( includes != null && excludes != null )
+        {
+            msg.append( " with includes " );
+            msg.append( includes );
+            msg.append( " and excludes " );
+            msg.append( excludes );
+        }
+        else if ( includes != null )
+        {
+            msg.append( " with includes " );
+            msg.append( includes );
+        }
+        else if ( excludes != null )
+        {
+            msg.append( " with excludes " );
+            msg.append( excludes );
+        }
+
+        getLog().info( msg.toString() );
+    }
 }


Reply via email to