enforcer:enforce

Full name:

org.apache.maven.plugins:maven-enforcer-plugin:3.4.1:enforce

Description:

This goal executes the defined enforcer-rules once per module.

Attributes:

  • Requires a Maven project to be executed.
  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: validate.

Optional Parameters

Name Type Since Description
<commandLineRules> List<String> - Deprecated. List of strings that matches the EnforcerRules to execute.
User property is: rules.
<fail> boolean - Flag to fail the build if at least one check fails.
Default value is: true.
User property is: enforcer.fail.
<failFast> boolean - Fail on the first rule that doesn't pass
Default value is: false.
User property is: enforcer.failFast.
<failIfNoRules> boolean 3.2.0 Flag to fail the build if no rules are present
Default value is: true.
User property is: enforcer.failIfNoRules.
<ignoreCache> boolean - Use this flag to disable rule result caching. This will cause all rules to execute on each project even if the rule indicates it can safely be cached.
Default value is: false.
User property is: enforcer.ignoreCache.
<rules> PlexusConfiguration 1.0.0 Rules configuration to execute as XML. Each first level tag represents rule name to execute. Inner tags are configurations for rule. Eg:
    <rules>
        <alwaysFail/>
        <alwaysPass>
            <message>message for rule</message>
        </alwaysPass>
        <myRule implementation="org.example.MyRule"/>
    </rules>

<rulesToExecute> List<String> 3.2.0 List of strings that matches the EnforcerRules to execute. Replacement for the rules property.
User property is: enforcer.rules.
<rulesToSkip> List<String> 3.2.0 List of strings that matches the EnforcerRules to skip.
User property is: enforcer.skipRules.
<skip> boolean - Flag to easily skip all checks
Default value is: false.
User property is: enforcer.skip.

Parameter Details

<commandLineRules>

Deprecated. Use enforcer.rules property instead
List of strings that matches the EnforcerRules to execute.
  • Type: java.util.List<java.lang.String>
  • Required: No
  • User Property: rules

<fail>

Flag to fail the build if at least one check fails.
  • Type: boolean
  • Required: No
  • User Property: enforcer.fail
  • Default: true

<failFast>

Fail on the first rule that doesn't pass
  • Type: boolean
  • Required: No
  • User Property: enforcer.failFast
  • Default: false

<failIfNoRules>

Flag to fail the build if no rules are present
  • Type: boolean
  • Since: 3.2.0
  • Required: No
  • User Property: enforcer.failIfNoRules
  • Default: true

<ignoreCache>

Use this flag to disable rule result caching. This will cause all rules to execute on each project even if the rule indicates it can safely be cached.
  • Type: boolean
  • Required: No
  • User Property: enforcer.ignoreCache
  • Default: false

<rules>

Rules configuration to execute as XML. Each first level tag represents rule name to execute. Inner tags are configurations for rule. Eg:
    <rules>
        <alwaysFail/>
        <alwaysPass>
            <message>message for rule</message>
        </alwaysPass>
        <myRule implementation="org.example.MyRule"/>
    </rules>
  • Type: org.codehaus.plexus.configuration.PlexusConfiguration
  • Since: 1.0.0
  • Required: No

<rulesToExecute>

List of strings that matches the EnforcerRules to execute. Replacement for the rules property.
  • Type: java.util.List<java.lang.String>
  • Since: 3.2.0
  • Required: No
  • User Property: enforcer.rules

<rulesToSkip>

List of strings that matches the EnforcerRules to skip.
  • Type: java.util.List<java.lang.String>
  • Since: 3.2.0
  • Required: No
  • User Property: enforcer.skipRules

<skip>

Flag to easily skip all checks
  • Type: boolean
  • Required: No
  • User Property: enforcer.skip
  • Default: false