You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ke...@apache.org on 2007/01/19 13:05:47 UTC

svn commit: r497785 - /maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java

Author: kenney
Date: Fri Jan 19 04:05:46 2007
New Revision: 497785

URL: http://svn.apache.org/viewvc?view=rev&rev=497785
Log:
When help:effective-pom is called from within a pom,
only print out that pom's effective pom.
Added check to only dump all poms if the ${project} is the head of
the reactor list to enforce proper aggregator behaviour.

TODO: maybe this needs an update: find the current project
in the reactor projects, then dump that pom, and find all
modules recursively and dump those, so you can dump a sub-tree
of the reactor, when you run the mojo from the lifecycle.


Modified:
    maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java

Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java?view=diff&rev=497785&r1=497784&r2=497785
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java Fri Jan 19 04:05:46 2007
@@ -39,6 +39,12 @@
 public class EffectivePomMojo
     extends AbstractMojo
 {
+    /**
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
 
     /**
      * The projects in the current build. The effective-POM for
@@ -64,13 +70,23 @@
         throws MojoExecutionException
     {
         StringBuffer message = new StringBuffer();
-        
-        for ( Iterator it = projects.iterator(); it.hasNext(); )
+
+        if ( projects.get( 0 ).equals( project ) )
+        {
+            // this is normal in aggregation mode.
+
+            for ( Iterator it = projects.iterator(); it.hasNext(); )
+            {
+                MavenProject project = (MavenProject) it.next();
+                
+                getEffectivePom( project, message );
+                
+                message.append( "\n\n" );
+            }
+        }
+        else
         {
-            MavenProject project = (MavenProject) it.next();
-            
             getEffectivePom( project, message );
-            
             message.append( "\n\n" );
         }