You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Delany (Jira)" <ji...@apache.org> on 2021/08/25 07:14:00 UTC

[jira] [Created] (MENFORCER-397) allow no rules

Delany created MENFORCER-397:
--------------------------------

             Summary: allow no rules
                 Key: MENFORCER-397
                 URL: https://issues.apache.org/jira/browse/MENFORCER-397
             Project: Maven Enforcer Plugin
          Issue Type: Improvement
          Components: Plugin
    Affects Versions: 3.0.0
            Reporter: Delany


Allow no rules by adding property similar to [http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#failIfNoTests]

Currently the execution fails
{quote}No rules are configured. Use the skip flag if you want to disable execution.
{quote}
For some background, my strategy in dealing with lots of XML is to configure plugin executions upfront with an id, goal, and default properties, and then allow modules to populate them with the minimum e.g.
{code:java}
          <executions>
            <execution>
              <id>fail</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <fail>true</fail>
              </configuration>
            </execution>
            <execution>
              <id>warn</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <fail>true</fail>
              </configuration>
            </execution>
          </executions>
{code}
and then
{code:java}
            <executions>
              <execution>
                <id>warn</id>
                <configuration>
                  <rules>
                    <requireProperty>
                      <property>remote.name</property>
                      <message>Distribution profile invoked without setting a remote.name: repositories may not be configured correctly</message>
                    </requireProperty>
                  </rules>
                </configuration>
              </execution>
            </executions>
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)