enforcer:enforce

Full name:

org.apache.maven.plugins:maven-enforcer-plugin:3.5.0: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.
Use enforcer.rules property instead

List of strings that matches the EnforcerRules to execute.
User Property: rules
<fail> boolean - Flag to fail the build if at least one check fails.
Default: true
User Property: enforcer.fail
<failFast> boolean - Fail on the first rule that doesn't pass
Default: false
User Property: enforcer.failFast
<failIfNoRules> boolean 3.2.0 Flag to fail the build if no rules are present
Default: true
User Property: 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: false
User Property: 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: enforcer.rules
<rulesToSkip> List<String> 3.2.0 List of strings that matches the EnforcerRules to skip.
User Property: enforcer.skipRules
<skip> boolean - Flag to easily skip all checks
Default: false
User Property: 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