laeubi commented on pull request #690:
URL: https://github.com/apache/maven/pull/690#issuecomment-1064962195


   > I tend to think that the current design is somewhat broken if whenever you 
need to lookup a component, you need to go through a complex setup in order to 
find where to load the component from.
   
   You don't need it "whenever you lookup" you only need it for the specific 
cases of where you have a project-scoped extension and that is required to 
isolate the class-realms to not leak classes from one project into another.
   
   > The plexus container has support for importing from various _visible_ 
realms. I think at each stage of the build (after entering the session scope, 
during the build of a given project, during the execution of a mojo), a 
corresponding realm should be setup and associated to the TCCL so that lookups 
can be performed with the correct visibility and scope.
   
   Sure why not, but then your extension would still not work in a 
session-scoped nor a singelton created in "root scope"... So your usage has 
only worked due to a bug (as far as I can tell from the provided information 
here) and I don't see how it could work with other ways of class-loader 
isolation.
   
   > so that's definitely not an issue.
   
   So I'm really confused *what* is the issue then? As from the code, your 
problematic component is to be used in a singleton injected and called, how is 
it (and why) supposed to work if it is defined in a project scope? 
`extensions.xml` is exactly the place to place such "global for all" plugins, 
the `pom.xml` is not ...  If one likes to "break" the rules then additional 
setup is required, unless maven supports better ways, e.g. `@ProjectScoped` but 
then still someone has to setup this scope at distinct points (e.g. wen 
executing the mojos of a project and can't assume it works everywhere... so 
most probably `MojoExecutor` has to not reference the `MojoExecutionStrategy` 
in the constructor but look it up in the actual call.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to