You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Björn Raupach (Jira)" <ji...@apache.org> on 2022/07/31 12:59:00 UTC

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

    [ https://issues.apache.org/jira/browse/MENFORCER-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17573425#comment-17573425 ] 

Björn Raupach commented on MENFORCER-397:
-----------------------------------------

Tried another PR.

https://github.com/apache/maven-enforcer/pull/178

> 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
>            Priority: Minor
>              Labels: up-for-grabs
>
> 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>false</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.20.10#820010)