maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1163363 - /maven/archetype/trunk/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
Date Tue, 30 Aug 2011 20:03:14 GMT
Author: hboutemy
Date: Tue Aug 30 20:03:14 2011
New Revision: 1163363

URL: http://svn.apache.org/viewvc?rev=1163363&view=rev
Log:
[ARCHETYPE-355] added a check to avoid NPE if a user runs 'mvn archetype:integration-test'
(instead of 'mvn integration-test')

Modified:
    maven/archetype/trunk/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java

Modified: maven/archetype/trunk/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java?rev=1163363&r1=1163362&r2=1163363&view=diff
==============================================================================
--- maven/archetype/trunk/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
(original)
+++ maven/archetype/trunk/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
Tue Aug 30 20:03:14 2011
@@ -60,6 +60,9 @@ import java.util.Properties;
  * <li>an optional <code>reference/</code> directory containing a reference
copy of the expected project created from the IT.</li>
  * </ul>
  *
+ * Notice that it is expected to be run as part as of a build after the <code>package</code>
phase and not directly
+ * as a goal from CLI.
+ *
  * @author rafale
  * @requiresProject true
  * @goal integration-test
@@ -107,6 +110,16 @@ public class IntegrationTestMojo
             return;
         }
 
+        File archetypeFile = project.getArtifact().getFile();
+
+        if ( archetypeFile == null )
+        {
+            throw new MojoFailureException(
+                                            "Unable to get the archetypes' artifact which
should have just been built:"
+                                                + " you probably launched 'mvn archetype:integration-test'
instead of"
+                                                + " 'mvn integration-test'." );
+        }
+
         try
         {
             @SuppressWarnings( "unchecked" )
@@ -119,8 +132,6 @@ public class IntegrationTestMojo
                 return;
             }
 
-            File archetypeFile = project.getArtifact().getFile();
-
             StringWriter errorWriter = new StringWriter();
             for ( File goalFile : projectsGoalFiles )
             {



Mime
View raw message