[ 
http://jira.codehaus.org/browse/MNG-1323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_102015
 ] 

Piotr Tabor commented on MNG-1323:
----------------------------------

Sent to [EMAIL PROTECTED]:

Business (user's) problem:

The problem is that maven only once resolve dependencies for every plugin's KEY 
(plugin's groupId:artifactId) - not for
every mavan USAGE. But the pom's <plugin><dependencies></dependencies></plugin> 
tag allows for specifying plugin's dependencies per
every USAGE. In current maven's version (2.0.8-SNAPSHOT, 2.1-SNAPSHOT) the all 
plugin's USAGES are using the same dependencies as the first USAGE.
It is especially annoying with maven-antrun-plugin (that is often used with 
diffrent "tags" dependencies).

Implementation situation:

Facts:
    *    PluginDescriptors class constain's resolved plugin's dependencies
    *    MavenPluginCollector constains cache - map  (pluginKey 
(groupId:artifactId) into PluginDescriptors)
    *    DefaultPluginManager.verifyVersionedPlugin (is responsible for 
transferring Plugin object into PluginDescriptor)
          uses MavenPluginCollector to check if the right entry exists.
   

There are possible such a fixes:

    1) The worst: Remove caching (every plugin's environment (including) child 
plexusContainer has to be recalculated for each maven usage)  - simplest to 
implement (and working patch is in JIRA comments))

    2) Better: Check after getting PluginDescriptor from MavenPluginCollector:
          
if(comutativeEquals(!pluginCollector.getPluginDescriptor(plugin).getIntroducedDependencyArtifacts(),
 plugin.getDependencies()))
          {
             recalculateTheEntry();
          }         

       adventages: simple to implement (change in single place)

       disadventages: If there are two (or more) usage of the same plugin      
(interlaced) the one will be cashed and the other will be recalculated
with each use. 
        3 ) to change the plugin identificator for this cashing from: 
groupId:artifactId  to groupId:artifactId:comutativeHashCode(getDependencies())
      
adventages: the best for performance
disadventages:
       a) many changes in many places
       b) I am a little bit afraid about resolving plugin's transitive 
dependencies (they seems to be  resolved "lazily", so the dependencies list so 
the cache key too)...
(but I'm sure it is to be worked out)

Am I right? Please comment... At least to motivate me to work on this issue 
further. 

> Plugin extensions (dependencies) not resolved in reactor build
> --------------------------------------------------------------
>
>                 Key: MNG-1323
>                 URL: http://jira.codehaus.org/browse/MNG-1323
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Plugins and Lifecycle
>    Affects Versions: 2.0
>            Reporter: Kenney Westerhof
>             Fix For: 2.0.x
>
>         Attachments: MNG-1323-core-integration-tests.diff
>
>
> I've added a dependency on an Ant Task in 
> project/build/plugins/plugin[artifactId='maven-antrun-plugin']/dependencies/ 
> and run that anttask using the antrun plugin.
> When run from the project dir itself it runs fine.
> When running from the root of the project tree (reactor build, project one 
> level below root),
> antrun bails out because the taskdef can't be found (not on classpath).
> It looks like the dependency isn't resolved, or not added to the plugins' 
> classrealm.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to