psiroky commented on code in PR #211:
URL: https://github.com/apache/maven-enforcer/pull/211#discussion_r1059071349


##########
maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java:
##########
@@ -153,6 +155,25 @@ public class EnforceMojo extends AbstractMojo {
     @Component
     private EnforcerRuleManager enforcerRuleManager;
 
+    /**
+     * List of strings that matches the EnforcerRules to execute.
+     *
+     * @deprecated Use <code>enforcer.rules</code> property instead
+     */
+    @Parameter(required = false, property = "rules")
+    @Deprecated
+    public void setCommandLineRules(List<String> rulesToExecute) {
+        if (rulesToExecute != null && !rulesToExecute.isEmpty()) {
+            this.rulesToExecute = rulesToExecute;
+        }
+    }
+
+    public void setRulesToExecute(List<String> rulesToExecute) {
+        if (rulesToExecute != null && !rulesToExecute.isEmpty()) {
+            this.rulesToExecute = rulesToExecute;
+        }
+    }

Review Comment:
   The only disadvantage of this approach is that we don't really have a direct 
control of which method is called first, so if both properties are specified 
the behavior could be potentially different (from what I was able to observe, 
the `setCommandLineRules` is getting called first, but I am not sure if that's 
guaranteed every time).



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to