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 2017/12/20 09:36:13 UTC

[maven-help-plugin] 32/35: [MPH-16] help:active-profiles doesn't include profiles derived from the parent pom. Submitted by: David Boden Reviewed by: Dennis Lundberg

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-help-plugin-2.0.2
in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git

commit e2d3d37f1c9deb1c940d6b73af97ce33f85a074d
Author: Dennis Lundberg <de...@apache.org>
AuthorDate: Sun Nov 11 23:39:58 2007 +0000

    [MPH-16] help:active-profiles doesn't include profiles derived from the parent pom.
    Submitted by: David Boden
    Reviewed by: Dennis Lundberg
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-help-plugin@593993 13f79535-47bb-0310-9956-ffa450edef68
---
 .../maven/plugins/help/ActiveProfilesMojo.java      | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java b/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java
index 1bbb64d..02443e4 100644
--- a/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java
@@ -143,7 +143,7 @@ public class ActiveProfilesMojo extends AbstractMojo
      */
     private void getActiveProfileStatement( MavenProject project, StringBuffer message )
     {
-        List profiles = project.getActiveProfiles();
+        List profiles = collectActiveProfiles( project );
         
         message.append( "\n" );
         
@@ -173,6 +173,25 @@ public class ActiveProfilesMojo extends AbstractMojo
     }
 
     /**
+     * Recurses into the project's parent poms to find the active
+     * profiles of the specified project and all its parents.
+     *
+     * @param project The project to start with
+     * @return A list of active profiles
+     */
+    private List collectActiveProfiles( MavenProject project )
+    {
+        List profiles = project.getActiveProfiles();
+
+        if ( project.hasParent() )
+        {
+            profiles.addAll( collectActiveProfiles( project.getParent() ) );
+        }
+
+        return profiles;
+    }
+
+    /**
      * Setter method for the list of projects.
      *
      * @param projects

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.