gmshake closed pull request #34: [MENFORCER-185] [WIP] Excludes take 
reactorProjects into account
URL: https://github.com/apache/maven-enforcer/pull/34
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
 
b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
index 489bb7c..5faf344 100644
--- 
a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
+++ 
b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
@@ -30,6 +30,7 @@
 import 
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
 import 
org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -47,6 +48,11 @@
 
     private transient DependencyGraphBuilder graphBuilder;
 
+    /**
+     * Contains the full list of projects in the reactor.
+     */
+    private List<MavenProject> reactorProjects;
+
     @Override
     public void execute( EnforcerRuleHelper helper )
         throws EnforcerRuleException
@@ -63,6 +69,16 @@ public void execute( EnforcerRuleHelper helper )
             throw new EnforcerRuleException( "Unable to retrieve the 
MavenProject: ", eee );
         }
 
+        // get the reactor projects
+        try
+        {
+            reactorProjects = (List<MavenProject>) helper.evaluate( 
"${reactorProjects}" );
+        }
+        catch ( ExpressionEvaluationException eee )
+        {
+            throw new EnforcerRuleException( "Unable to retrieve the reactor 
MavenProject: ", eee );
+        }
+
         try
         {
             graphBuilder = (DependencyGraphBuilder) helper.getComponent( 
DependencyGraphBuilder.class );
@@ -119,7 +135,7 @@ protected CharSequence getErrorMessage( Artifact artifact )
         Set<Artifact> dependencies = null;
         try
         {
-            DependencyNode node = graphBuilder.buildDependencyGraph( project, 
null );
+            DependencyNode node = graphBuilder.buildDependencyGraph( project, 
null, reactorProjects );
             if ( searchTransitive )
             {
                 dependencies = getAllDescendants( node );
@@ -191,4 +207,19 @@ public void setSearchTransitive( boolean 
theSearchTransitive )
         this.searchTransitive = theSearchTransitive;
     }
 
+    /**
+     * @return the reactorProjects
+     */
+    public List<MavenProject> getReactorProjects()
+    {
+        return reactorProjects;
+    }
+
+    /**
+     * @param reactorProjects the reactorProjects to set
+     */
+    public void setReactorProjects( List<MavenProject> reactorProjects )
+    {
+        this.reactorProjects = reactorProjects;
+    }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to