josephw commented on code in PR #152:
URL: https://github.com/apache/maven-enforcer/pull/152#discussion_r883358525


##########
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java:
##########
@@ -120,6 +120,36 @@ protected CharSequence getErrorMessage( Artifact artifact )
         return "Found Banned Dependency: " + artifact.getId() + 
System.lineSeparator();
     }
 
+    private Set<Artifact> getDependenciesToCheck( EnforcerRuleHelper helper, 
ProjectBuildingRequest buildingRequest )
+    {
+        if ( helper == null )
+        {
+            return getDependenciesToCheck( buildingRequest );
+        }
+
+        String cacheKey = buildingRequest.getProject().getId() + "_" + 
searchTransitive;
+
+        // check in the cache
+        if ( helper.getContainer().getContext().contains( cacheKey ) )

Review Comment:
   This behaviour works for us, but I'm not clear whether it's a suitable place 
for a cache. [This post from the mailing 
list](https://lists.apache.org/thread/12vv716gcxo97nyzcb00qt19wx10l2m4) 
suggests:
   > Most of these cache would seem to be relevant at the "MavenExecution"
   level, i.e. we could choose to ditch all of this at the end of each
   build without loosing any real performance.
   
   Is there a better place now to get a cache with that lifecycle?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to