You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tamas Cservenak (Jira)" <ji...@apache.org> on 2022/11/12 19:43:00 UTC

[jira] [Comment Edited] (MNG-7574) Never expose Mojo classes via Core Classloader

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

Tamas Cservenak edited comment on MNG-7574 at 11/12/22 7:42 PM:
----------------------------------------------------------------

Something is very off here, and please do not do anything unless clarified.

First, if a plugin is marked as "extension", it is Build Extension, not Core Extension (those in lib/ext), has nothing to do with Maven Core. Second, if a plugin is marked as "extension", it has no Plugin Realm but Build Extension realm (that outlives each project, unlike "ordinary" plugin). So, your description of the problem is very unclear to me. Please see here for classloading: [http://takari.io/book/91-maven-classloading.html]

Moreover, the issue concludes there is no problem actually, as Project classloader takes precedence... or whatever.

What problem are you trying to solve here?


was (Author: cstamas):
Something is very off here, and please do not do anything unless clarified.

First, if a plugin is marked as "extension", it is Build Extension, not Core Extension (those in lib/ext), has nothing to do with Maven Core. Second, if a plugin is marked as "extension", it has no Plugin Realm but Build Extension realm (that outlives each project, unlike "ordinary" plugin). So, your description of the problem is very unclear to me. Please see here for classloading: [http://takari.io/book/91-maven-classloading.html]

Moreover, the problem states there is no problem actually, as Project classloader takes precedence... or whatever.

What problem are you trying to solve here?

> Never expose Mojo classes via Core Classloader
> ----------------------------------------------
>
>                 Key: MNG-7574
>                 URL: https://issues.apache.org/jira/browse/MNG-7574
>             Project: Maven
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Konrad Windszus
>            Priority: Major
>
> Currently if a Maven plugin is loaded with {{<extensions>true</extensions}} all classes of the underlying artifact are exposed through the Maven Core Classloader (https://github.com/apache/maven/blob/415eaf31de407efcbf61166afd8cf4e86cdafe11/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java#L243 and https://github.com/apache/maven/blob/415eaf31de407efcbf61166afd8cf4e86cdafe11/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java#L345).
> At least the Mojo classes should IMHO be excluded otherwise they are exposed through both the plugin and core classloader for no reason (as the core classloader as parent always takes precedence).
> As {{extensions}} is accepting String values (https://github.com/apache/maven/blob/daa8e1690226fc385db3d448ad962997afe3dba8/api/maven-api-model/src/main/mdo/maven.mdo#L2215) one could accept the old values "true" (all) and "false" (nothing) next to some allowed resource name prefixes (comma-separated).



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