Attached mojos with the @aggregator tag can yield bad results in a multi-module 
project
---------------------------------------------------------------------------------------

         Key: MNG-2028
         URL: http://jira.codehaus.org/browse/MNG-2028
     Project: Maven 2
        Type: Bug

  Components: Plugins and Lifecycle  
    Versions: 2.0.2    
    Reporter: John Didion


I am using an attached version of the directory assembly plugin. I also have a 
multi-module project that is several levels deep. Here's an overview

myproject
  tools
  libraries
    library1
    library2
    library3

If I configure the attached directory assembly plugin in library1's POM and 
then run maven install from the myproject directory, I get errors about 
dependency resolution because the presence of the @aggregator tag causes maven 
to try and resolve dependencies for all modules in the entire project. That 
means it's trying to resolve dependencies for library3, which is a problem if 
library3 depends on library2, which hasn't been built yet.

It makes sense to me that dependency resolution should only happen on the 
sub-modules of the POM that configures the aggregator plugin, not all modules 
in the project.

If this makes sense then I think the fix would be in 
DefaultPluginManager.executeMojo():

if ( mojoDescriptor.isDependencyResolutionRequired() != null )
        {
            Collection projects;

            if ( mojoDescriptor.isAggregator() && project.getModules() != null 
&& !project.getModules().isEmpty())
            {
                List modules = project.getModules();
                projects = new ArrayList(modules.size());
                for (Iterator itr = modules.iterator(); itr.hasNext();) {
                    String module = (String) itr.next();
                    MavenProject moduleProject = // load the project for the 
module...don't know exactly how to do this
                    projects.add(moduleProject);
                }
            }
 ...

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to