You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2012/05/14 22:26:18 UTC

svn commit: r1338386 - in /maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance: pom.xml src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java verify.groovy

Author: olamy
Date: Mon May 14 20:26:18 2012
New Revision: 1338386

URL: http://svn.apache.org/viewvc?rev=1338386&view=rev
Log:
improve test of requiresDependencyResolution

Modified:
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy

Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml?rev=1338386&r1=1338385&r2=1338386&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml Mon May 14 20:26:18 2012
@@ -47,6 +47,11 @@ under the License.
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
       <artifactId>maven-project</artifactId>
       <version>@mavenVersion@</version>
     </dependency>
@@ -78,6 +83,17 @@ under the License.
         </exclusion>
       </exclusions>
     </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>3.0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-exec</artifactId>
+      <version>1.1</version>
+      <scope>runtime</scope>
+    </dependency>
   </dependencies>
 
   <build>

Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java?rev=1338386&r1=1338385&r2=1338386&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java Mon May 14 20:26:18 2012
@@ -19,6 +19,7 @@ package org.apache.maven.plugin.coreit;
  * under the License.
  */
 
+import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.DependencyScope;
@@ -27,13 +28,16 @@ import org.apache.maven.plugins.annotati
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 
+import java.util.Set;
+
 /**
  * Touches a test file.
  *
  * @since 1.2
  * @deprecated Don't use!
  */
-@Mojo( name = "first", requiresDependencyResolution = DependencyScope.TEST, defaultPhase = LifecyclePhase.INTEGRATION_TEST )
+@Mojo( name = "first", requiresDependencyResolution = DependencyScope.COMPILE,
+       defaultPhase = LifecyclePhase.INTEGRATION_TEST )
 @Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura" )
 public class FirstMojo
     extends AbstractFirstMojo
@@ -49,14 +53,17 @@ public class FirstMojo
     @Component( role = "org.apache.maven.project.MavenProjectHelper" )//, roleHint = "default"
     private Object projectHelper;
 
+    @Parameter( defaultValue = "${project.artifacts}", required = true, readonly = true )
+    private Set<Artifact> dependencies;
+
     public void execute()
         throws MojoExecutionException
     {
-        if (basedir == null)
+        if ( basedir == null )
         {
             throw new MojoExecutionException( "basedir == null" );
         }
-        if (touchFile == null)
+        if ( touchFile == null )
         {
             throw new MojoExecutionException( "touchFile == null" );
         }
@@ -69,6 +76,11 @@ public class FirstMojo
             throw new MojoExecutionException( "compilerManager == null" );
         }
 
+        if ( dependencies.isEmpty() )
+        {
+            throw new MojoExecutionException( "dependencies.isEmpty()" );
+        }
+
     }
 
 }

Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy?rev=1338386&r1=1338385&r2=1338386&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy Mon May 14 20:26:18 2012
@@ -19,7 +19,7 @@ assert mojo.implementation.text() == 'or
 assert mojo.language.text() == 'java'
 assert mojo.description.text() == 'Touches a test file.'
 assert mojo.deprecated.text() == "Don't use!"
-assert mojo.requiresDependencyResolution.text() == 'test'
+assert mojo.requiresDependencyResolution.text() == 'compile'
 assert mojo.requiresDependencyCollection.text() == 'runtime'
 assert mojo.requiresProject.text() == 'true'
 assert mojo.requiresOnline.text() == 'false'
@@ -44,7 +44,7 @@ assert mojo.requirements.requirement[2].
 //assert mojo.requirements.requirement[2].'role-hint'.text() == 'default'
 assert mojo.requirements.requirement[2].'field-name'.text() == 'projectHelper'
 
-assert mojo.parameters.parameter.size() == 3
+assert mojo.parameters.parameter.size() == 4
 
 def parameter = mojo.parameters.parameter.findAll{ it.name.text() == "aliasedParam"}[0]