Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify availability of AbstractEnforcerRule #278

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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