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 456c940
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* <a href="https://maven.apache.org/enforcer/enforcer-api/writing-a-custom-rule.html">Writing a custom rule</a>
*
* @author Slawomir Jaranowski
* @since 3.2.0
* @since 3.2.1
*/
public abstract class AbstractEnforcerRule extends AbstractEnforcerRuleBase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Used for internal purpose.
*
* @author Slawomir Jaranowski
* @since 3.2.0
* @since 3.2.1
*/
abstract class AbstractEnforcerRuleBase implements EnforcerRuleBase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* Provided configuration will be added to current rules list by {@code Enforcer Mojo}
*
* @author Slawomir Jaranowski
* @since 3.2.0
* @since 3.2.1
*/
public abstract class AbstractEnforcerRuleConfigProvider extends AbstractEnforcerRuleBase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Logger used by enforcer rule.
*
* @author Slawomir Jaranowski
* @since 3.2.0
* @since 3.2.1
*/
public interface EnforcerLogger {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Used for internal purpose.
*
* @author Slawomir Jaranowski
* @since 3.2.0
* @since 3.2.1
*/
public interface EnforcerRuleBase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* This exception break a build immediate.
*
* @author Slawomir Jaranowski
* @since 3.2.0
* @since 3.2.1
*/
public class EnforcerRuleError extends EnforcerRuleException {

Expand Down
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 {{{./apidocs/org/apache/maven/enforcer/rule/api/AbstractEnforcerRule.html}AbstractEnforcerRule}} (available since API version 3.2.1) 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 456c940

Please sign in to comment.