You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Konrad Windszus (Jira)" <ji...@apache.org> on 2023/01/01 10:18:00 UTC

[jira] [Comment Edited] (MENFORCER-425) Clarify class loading for custom Enforcer rules

    [ https://issues.apache.org/jira/browse/MENFORCER-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17653391#comment-17653391 ] 

Konrad Windszus edited comment on MENFORCER-425 at 1/1/23 10:17 AM:
--------------------------------------------------------------------

Let us also clarify that only the API is safe to use from custom rules, but not any other classes exposed on the class path (particularly not the ones from https://github.com/apache/maven-enforcer/tree/master/enforcer-rules) as those may have breaking changes in every m-enforcer release. [~sjaranowski] WDYT?

Currently https://github.com/apache/maven-enforcer/blob/246c49ea17ffe397c1233a00c9d517b9843aa164/enforcer-api/src/site/apt/writing-a-custom-rule.apt.vm#L79-L80 is not explicit enough (and even mentions that one may depend on m-enforcer-rules in custom rules which is IMHO at least discouraged).


was (Author: kwin):
Let us also clarify that only the API is safe to use from custom rules, but not any other classes exposed on the class path (particularly not the ones from https://github.com/apache/maven-enforcer/tree/master/enforcer-rules) as those may have breaking changes in every m-enforcer release. [~sjaranowski] WDYT?

> Clarify class loading for custom Enforcer rules 
> ------------------------------------------------
>
>                 Key: MENFORCER-425
>                 URL: https://issues.apache.org/jira/browse/MENFORCER-425
>             Project: Maven Enforcer Plugin
>          Issue Type: Improvement
>          Components: Documentation
>            Reporter: Konrad Windszus
>            Assignee: Slawomir Jaranowski
>            Priority: Major
>             Fix For: 3.2.0
>
>
> Currently the documentation at https://maven.apache.org/enforcer/enforcer-api/writing-a-custom-rule.html#writing-a-custom-rule has an example leveraging the default (i.e. compile) scope for all dependencies.
> IMHO custom rules share the classloader with the embedding m-enforcer-p and therefore don't need "compile" scope for any of the dependencies which are always loaded by m-enforcer-p (compare with MPLUGIN-370). Those dependencies are https://github.com/apache/maven-enforcer/blob/master/maven-enforcer-plugin/pom.xml#L63-L70. That should be mentioned in the documentation for custom rules as well.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)