问题
I am following writing-a-custom-rule document to create custom rule and applying it.
My enforcer plugin execution has the following entry in pom.xml file-
<execution>
<id>enforce-no-masters</id>
<configuration>
<skip>${masterDependenciesAllowed}</skip>
<rules>
<myCustomRule implementation="or.apache.customRule.CustomRule">
<excludes>
<exclude>*:*:master-*:*:*</exclude>
</excludes>
<shouldIfail>false</shouldIfail>
</myCustomRule>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
The issue is if I keep <shouldIfail>true</shouldIfail>
then I always get failure and if I keep <shouldIfail>false</shouldIfail>
then I always get success.
so I don't know that how to put value of java class variable shouldIfail
in the tag so that it will be dynamically pass or fail based on logic.
来源:https://stackoverflow.com/questions/48338179/maven-custom-rule-failing-or-passing-without-considering-custom-rule