Skip to content

Commit

Permalink
[MENFORCER-425] Clarify usage of maven-enforcer-rules (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwin authored Jan 1, 2023
1 parent 246c49e commit edfd5b1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions enforcer-api/src/site/apt/writing-a-custom-rule.apt.vm
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ Writing a custom rule
</build>
</project>
+---+
Note that the classloader is shared with the embedding <<<maven-enforcer-plugin>>> (a regular {{{https://maven.apache.org/guides/mini/guide-maven-classloading.html#3-plugin-classloaders}plugin classloader}})
Note that the classloader is shared with the embedding <<<maven-enforcer-plugin>>> (a regular {{{https://maven.apache.org/guides/mini/guide-maven-classloading.html#Plugin_Classloaders}plugin classloader}})
and therefore the artifacts <<<org.apache.maven.enforcer:enforcer-api>>> and <<<org.apache.maven.enforcer:enforcer-rules>>> are always loaded in the same version as the embedding <<<maven-enforcer-plugin>>>.
Custom rule artifacts should therefore only depend on them and core Maven artifacts with <<<provided>>> scope (for details refer to {{{https://issues.apache.org/jira/browse/MNG-7097}MNG-7097}}).
Custom rule artifacts should therefore only depend on `enforcer-api` and core Maven artifacts with <<<provided>>> scope (for details refer to {{{https://issues.apache.org/jira/browse/MNG-7097}MNG-7097}}).
The classes available from `enforcer-rules` must not be used from custom rules, as those are not considered API and may change in backwards-incompatible ways with every `maven-enforcer` version (even minor ones).

[[2]] Create your rule class. The rule must implement the {{{./apidocs/index.html}EnforcerRule}} interface.
The rule can get access to components and the log via the {{{./apidocs/index.html}EnforcerRuleHelper}} interface.
Expand Down Expand Up @@ -285,4 +286,4 @@ public class MyCustomRule
</build>
...
</project>
+---+
+---+

0 comments on commit edfd5b1

Please sign in to comment.