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


   I've tried a few things with your example and that led me to understand 
something I had missed.  If you define the following in the root pom:
   ```
     <build>
       <extensions>
         <extension>
           <groupId>org.eclipse.tycho</groupId>
           <artifactId>tycho-maven-plugin</artifactId>
           <version>${tycho-version}</version>
         </extension>
       </extensions>
     </build>
   ```
   then the build works correctly, which is exactly what I assumed would be 
working, but could not understand when reading the code and your comments.  
However I wrongly assumed the extension was using some kind of global scope 
mechanism, similar to the way workspace readers and lifecycle participants are 
scanned and registered.  The mechanism is completely different.
   In the above case, the extension is actually mapped to a plugin definition, 
and plugins are inherited.  This means that defining an extension in the root 
pom is like defining the extension in all children (using the parent model, and 
the not aggregating project, even though they are often the same).  Also, the 
`DefaultMavenPluginManager` uses a cache for realms, so that in those cases, a 
single classloader is reused for multiple usages of the extension.  And last, 
beans which are `@Singleton` or `@SessionScope` are cached by the scope, 
thereby making the extension actually _global_.
   
   In short, once I fix the bad lookup in maven, it seems the problem I had 
with the build cache extension does not occur anymore.  Btw, if you could have 
a look at https://github.com/apache/maven/pull/692 and 
https://github.com/apache/maven/pull/693, that would be nice !
   
   I'll rework my PR to not use the overall classloader I've introduced as a 
_global_ one.  And given it won't be a bug fix anymore, I'll target it for 
`master` only.
   


-- 
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