You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2012/08/01 22:58:44 UTC

svn commit: r1368246 - /maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java

Author: hboutemy
Date: Wed Aug  1 20:58:44 2012
New Revision: 1368246

URL: http://svn.apache.org/viewvc?rev=1368246&view=rev
Log:
[MDEP-187] improved error message to describe the real cause of the problem

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=1368246&r1=1368245&r2=1368246&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 Wed Aug  1 20:58:44 2012
@@ -41,6 +41,7 @@ import org.codehaus.plexus.util.Reflecti
 import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
+import java.io.IOException;
 import java.lang.reflect.Field;
 import java.util.List;
 
@@ -169,10 +170,16 @@ public abstract class AbstractDependency
             theLog.info(
                 "Copying " + ( this.outputAbsoluteArtifactFilename ? artifact.getAbsolutePath() : artifact.getName() )
                     + " to " + destFile );
-            FileUtils.copyFile( artifact, destFile );
 
+            if ( artifact.isDirectory() )
+            {
+                throw new MojoExecutionException( "Artifact has not been packaged yet. When used on reactor artifact, "
+                    + "copy should be executed after packaging: see MDEP-187." );
+            }
+
+            FileUtils.copyFile( artifact, destFile );
         }
-        catch ( Exception e )
+        catch ( IOException e )
         {
             throw new MojoExecutionException( "Error copying artifact from " + artifact + " to " + destFile, e );
         }