Skip to content

Commit

Permalink
Clarify availability of AbstractEnforcerRule
Browse files Browse the repository at this point in the history
Improve links to javadoc
Fix some typos
  • Loading branch information
kwin committed Jul 4, 2023
1 parent b3208e1 commit b83687b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions enforcer-api/src/site/apt/writing-a-custom-rule.apt.vm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Writing a custom rule

* Implementation of custom Enforcer Rule

The rule must extends the {{{./apidocs/index.html}AbstractEnforcerRule}} and implements <<<execute>>> method.
The rule must extend the {{{./apidocs/org/apache/maven/enforcer/rule/api/AbstractEnforcerRule.html}AbstractEnforcerRule}} (available since API version 3.2.0) and implement its <<<execute>>> method.

Add annotation <<<@Named("yourRuleName")>>> to your Rule class. Your Rule name must start with lowercase character.

Expand All @@ -58,7 +58,7 @@ Writing a custom rule
Maven component can be injected into Rule by annotation <<<@Inject>>> on field or constructor.

Entry point for Rule executing is <<<execute>>> method, tf the rule succeeds, it should just simply return.
If the rule fails, it should throw an {{{./apidocs/index.html}EnforcerRuleException}} with a descriptive message telling the user why the rule failed.
If the rule fails, it should throw an {{{./apidocs/org/apache/maven/enforcer/rule/api/EnforcerRuleException.html}EnforcerRuleException}} with a descriptive message telling the user why the rule failed.
Enforcer plugin takes decision based on configuration and Enforcer Rule level whether build should pass or fail.
In case when you want to brake build immediately, <<<execute>>> method can throw an {{{./apidocs/index.html}EnforcerRuleError}}.

Expand Down

0 comments on commit b83687b

Please sign in to comment.