maven custom rule failing or passing without considering custom rule

我与影子孤独终老i 提交于 2019-12-13 04:20:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!