You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2010/09/21 22:34:53 UTC

svn commit: r999612 [2/10] - in /maven/plugins/trunk/maven-assembly-plugin: ./ src/main/java/org/apache/maven/plugin/assembly/ src/main/java/org/apache/maven/plugin/assembly/archive/ src/main/java/org/apache/maven/plugin/assembly/archive/archiver/ src/...

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/FileItemAssemblyPhase.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/FileItemAssemblyPhase.java?rev=999612&r1=999611&r2=999612&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/FileItemAssemblyPhase.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/FileItemAssemblyPhase.java Tue Sep 21 20:34:50 2010
@@ -19,13 +19,8 @@ package org.apache.maven.plugin.assembly
  * under the License.
  */
 
-import java.io.File;
-import java.util.Iterator;
-import java.util.List;
-
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugin.assembly.AssemblyContext;
-import org.apache.maven.plugin.assembly.DefaultAssemblyContext;
 import org.apache.maven.plugin.assembly.archive.ArchiveCreationException;
 import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
 import org.apache.maven.plugin.assembly.format.FileFormatter;
@@ -35,16 +30,19 @@ import org.apache.maven.plugin.assembly.
 import org.apache.maven.plugin.assembly.utils.TypeConversionUtils;
 import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * Handles the top-level <files/> section of the assembly descriptor.
  * 
  * @version $Id$
- * @plexus.component role="org.apache.maven.plugin.assembly.archive.phase.AssemblyArchiverPhase"
- *                   role-hint="file-items"
  */
+@Component( role = AssemblyArchiverPhase.class, hint = "file-items" )
 public class FileItemAssemblyPhase
     extends AbstractLogEnabled
     implements AssemblyArchiverPhase
@@ -53,35 +51,26 @@ public class FileItemAssemblyPhase
     /**
      * {@inheritDoc}
      */
-    public void execute( Assembly assembly, Archiver archiver, AssemblerConfigurationSource configSource )
-        throws ArchiveCreationException, AssemblyFormattingException
-    {
-        execute( assembly, archiver, configSource, new DefaultAssemblyContext() );
-    }
-    
-    /**
-     * {@inheritDoc}
-     */
-    public void execute( Assembly assembly, Archiver archiver, AssemblerConfigurationSource configSource,
-                         AssemblyContext context )
+    public void execute( final Assembly assembly, final Archiver archiver,
+                         final AssemblerConfigurationSource configSource, final AssemblyContext context )
         throws ArchiveCreationException, AssemblyFormattingException
     {
-        List fileList = assembly.getFiles();
-        File basedir = configSource.getBasedir();
+        final List<FileItem> fileList = assembly.getFiles();
+        final File basedir = configSource.getBasedir();
 
-        FileFormatter fileFormatter = new FileFormatter( configSource, getLogger() );
-        for ( Iterator i = fileList.iterator(); i.hasNext(); )
+        final FileFormatter fileFormatter = new FileFormatter( configSource, getLogger() );
+        for ( final Iterator<FileItem> i = fileList.iterator(); i.hasNext(); )
         {
-            FileItem fileItem = (FileItem) i.next();
+            final FileItem fileItem = i.next();
 
-            String sourcePath = fileItem.getSource();
+            final String sourcePath = fileItem.getSource();
 
             // ensure source file is in absolute path for reactor build to work
             File source = new File( sourcePath );
 
             // save the original sourcefile's name, because filtration may
             // create a temp file with a different name.
-            String sourceName = source.getName();
+            final String sourceName = source.getName();
 
             if ( !source.isAbsolute() )
             {
@@ -97,7 +86,7 @@ public class FileItemAssemblyPhase
                 destName = sourceName;
             }
 
-            String outputDirectory =
+            final String outputDirectory =
                 AssemblyFormatUtils.getOutputDirectory( fileItem.getOutputDirectory(), configSource.getProject(), null,
                                                         configSource.getFinalName(), configSource );
 
@@ -121,7 +110,7 @@ public class FileItemAssemblyPhase
             {
                 archiver.addFile( source, target, TypeConversionUtils.modeToInt( fileItem.getFileMode(), getLogger() ) );
             }
-            catch ( ArchiverException e )
+            catch ( final ArchiverException e )
             {
                 throw new ArchiveCreationException( "Error adding file to archive: " + e.getMessage(), e );
             }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/FileSetAssemblyPhase.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/FileSetAssemblyPhase.java?rev=999612&r1=999611&r2=999612&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/FileSetAssemblyPhase.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/FileSetAssemblyPhase.java Tue Sep 21 20:34:50 2010
@@ -21,12 +21,13 @@ package org.apache.maven.plugin.assembly
 
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugin.assembly.AssemblyContext;
-import org.apache.maven.plugin.assembly.DefaultAssemblyContext;
 import org.apache.maven.plugin.assembly.archive.ArchiveCreationException;
 import org.apache.maven.plugin.assembly.archive.task.AddFileSetsTask;
 import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
 import org.apache.maven.plugin.assembly.model.Assembly;
+import org.apache.maven.plugin.assembly.model.FileSet;
 import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 
 import java.util.List;
@@ -35,9 +36,8 @@ import java.util.List;
  * Handles the &lt;fileSets/&gt; top-level section of the assembly descriptor.
  * 
  * @version $Id$
- * @plexus.component role="org.apache.maven.plugin.assembly.archive.phase.AssemblyArchiverPhase"
- *                   role-hint="file-sets"
  */
+@Component( role = AssemblyArchiverPhase.class, hint = "file-sets" )
 public class FileSetAssemblyPhase
     extends AbstractLogEnabled
     implements AssemblyArchiverPhase
@@ -46,24 +46,15 @@ public class FileSetAssemblyPhase
     /**
      * {@inheritDoc}
      */
-    public void execute( Assembly assembly, Archiver archiver, AssemblerConfigurationSource configSource )
+    public void execute( final Assembly assembly, final Archiver archiver,
+                         final AssemblerConfigurationSource configSource, final AssemblyContext context )
         throws ArchiveCreationException, AssemblyFormattingException
     {
-        execute( assembly, archiver, configSource, new DefaultAssemblyContext() );
-    }
-    
-    /**
-     * {@inheritDoc}
-     */
-    public void execute( Assembly assembly, Archiver archiver, AssemblerConfigurationSource configSource,
-                         AssemblyContext context )
-        throws ArchiveCreationException, AssemblyFormattingException
-    {
-        List fileSets = assembly.getFileSets();
+        final List<FileSet> fileSets = assembly.getFileSets();
 
         if ( ( fileSets != null ) && !fileSets.isEmpty() )
         {
-            AddFileSetsTask task = new AddFileSetsTask( fileSets );
+            final AddFileSetsTask task = new AddFileSetsTask( fileSets );
 
             task.setLogger( getLogger() );
             task.execute( archiver, configSource );

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhase.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhase.java?rev=999612&r1=999611&r2=999612&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhase.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhase.java Tue Sep 21 20:34:50 2010
@@ -23,13 +23,11 @@ import org.apache.maven.artifact.Artifac
 import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugin.assembly.AssemblyContext;
-import org.apache.maven.plugin.assembly.DefaultAssemblyContext;
 import org.apache.maven.plugin.assembly.InvalidAssemblerConfigurationException;
 import org.apache.maven.plugin.assembly.archive.ArchiveCreationException;
 import org.apache.maven.plugin.assembly.archive.task.AddArtifactTask;
 import org.apache.maven.plugin.assembly.archive.task.AddDependencySetsTask;
 import org.apache.maven.plugin.assembly.archive.task.AddFileSetsTask;
-import org.apache.maven.plugin.assembly.artifact.DependencyResolver;
 import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
 import org.apache.maven.plugin.assembly.model.Assembly;
 import org.apache.maven.plugin.assembly.model.DependencySet;
@@ -44,6 +42,8 @@ import org.apache.maven.plugin.assembly.
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.logging.Logger;
 
@@ -62,72 +62,53 @@ import java.util.Set;
  * Handles the &lt;moduleSets/&gt; top-level section of the assembly descriptor.
  * 
  * @version $Id$
- * @plexus.component role="org.apache.maven.plugin.assembly.archive.phase.AssemblyArchiverPhase" role-hint="module-sets"
  */
+@Component( role = AssemblyArchiverPhase.class, hint = "module-sets" )
 public class ModuleSetAssemblyPhase
-extends AbstractLogEnabled
-implements AssemblyArchiverPhase
+    extends AbstractLogEnabled
+    implements AssemblyArchiverPhase
 {
 
-    /**
-     * @plexus.requirement
-     */
+    @Requirement
     private MavenProjectBuilder projectBuilder;
 
-    /**
-     * @plexus.requirement
-     */
-    private DependencyResolver dependencyResolver;
-
     public ModuleSetAssemblyPhase()
     {
         // needed for plexus
     }
 
-    public ModuleSetAssemblyPhase( MavenProjectBuilder projectBuilder, DependencyResolver dependencyResolver,
-                                   Logger logger )
+    public ModuleSetAssemblyPhase( final MavenProjectBuilder projectBuilder, final Logger logger )
     {
         this.projectBuilder = projectBuilder;
-        this.dependencyResolver = dependencyResolver;
-
         enableLogging( logger );
     }
 
     /**
      * {@inheritDoc}
      */
-    public void execute( Assembly assembly, Archiver archiver, AssemblerConfigurationSource configSource )
-    throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException
-    {
-        execute( assembly, archiver, configSource, new DefaultAssemblyContext() );
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void execute( Assembly assembly, Archiver archiver, AssemblerConfigurationSource configSource,
-                         AssemblyContext context )
-    throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException
+    public void execute( final Assembly assembly, final Archiver archiver,
+                         final AssemblerConfigurationSource configSource, final AssemblyContext context )
+        throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException
     {
-        List moduleSets = assembly.getModuleSets();
+        final List<ModuleSet> moduleSets = assembly.getModuleSets();
 
-        for ( Iterator i = moduleSets.iterator(); i.hasNext(); )
+        for ( final Iterator<ModuleSet> i = moduleSets.iterator(); i.hasNext(); )
         {
-            ModuleSet moduleSet = ( ModuleSet ) i.next();
+            final ModuleSet moduleSet = i.next();
 
             validate( moduleSet, configSource );
 
-            Set moduleProjects = getModuleProjects( moduleSet, configSource, getLogger() );
+            final Set<MavenProject> moduleProjects = getModuleProjects( moduleSet, configSource, getLogger() );
 
-            ModuleSources sources = moduleSet.getSources();
+            final ModuleSources sources = moduleSet.getSources();
             addModuleSourceFileSets( sources, moduleProjects, archiver, configSource );
 
-            ModuleBinaries binaries = moduleSet.getBinaries();
+            final ModuleBinaries binaries = moduleSet.getBinaries();
             addModuleBinaries( binaries, moduleProjects, archiver, configSource, context );
         }
     }
 
-    private void validate( ModuleSet moduleSet, AssemblerConfigurationSource configSource )
+    private void validate( final ModuleSet moduleSet, final AssemblerConfigurationSource configSource )
     {
         if ( ( moduleSet.getSources() == null ) && ( moduleSet.getBinaries() == null ) )
         {
@@ -137,58 +118,56 @@ implements AssemblyArchiverPhase
         if ( moduleSet.isUseAllReactorProjects() && !moduleSet.isIncludeSubModules() )
         {
             getLogger().warn( "includeSubModules == false is incompatible with useAllReactorProjects. Ignoring."
-                              + "\n\nTo refactor, remove the <includeSubModules/> flag, and use the <includes/> "
-                              + "and <excludes/> sections to fine-tune the modules included." );
+                                              + "\n\nTo refactor, remove the <includeSubModules/> flag, and use the <includes/> "
+                                              + "and <excludes/> sections to fine-tune the modules included." );
         }
 
-        if ( configSource.getMavenSession() != null && configSource.getMavenSession().getSortedProjects() != null )
-        {
-            List projects = configSource.getMavenSession().getSortedProjects();
-            if ( projects.size() > 1 && projects.indexOf( configSource.getProject() ) == 0
-                            && moduleSet.getBinaries() != null )
-            {
-                getLogger().warn( "[DEPRECATION] moduleSet/binaries section detected in root-project assembly."
-                                  + "\n\nMODULE BINARIES MAY NOT BE AVAILABLE FOR THIS ASSEMBLY!"
-                                  + "\n\n To refactor, move this assembly into a child project and use the flag "
-                                  + "<useAllReactorProjects>true</useAllReactorProjects> in each moduleSet." );
-            }
+        final List<MavenProject> projects = configSource.getReactorProjects();
+        if ( projects != null && projects.size() > 1 && projects.indexOf( configSource.getProject() ) == 0
+                        && moduleSet.getBinaries() != null )
+        {
+            getLogger().warn( "[DEPRECATION] moduleSet/binaries section detected in root-project assembly."
+                                              + "\n\nMODULE BINARIES MAY NOT BE AVAILABLE FOR THIS ASSEMBLY!"
+                                              + "\n\n To refactor, move this assembly into a child project and use the flag "
+                                              + "<useAllReactorProjects>true</useAllReactorProjects> in each moduleSet." );
         }
 
         if ( moduleSet.getSources() != null )
         {
-            ModuleSources sources = moduleSet.getSources();
+            final ModuleSources sources = moduleSet.getSources();
             if ( isDeprecatedModuleSourcesConfigPresent( sources ) )
             {
                 getLogger().warn( "[DEPRECATION] Use of <moduleSources/> as a file-set is deprecated. "
-                                  + "Please use the <fileSets/> sub-element of <moduleSources/> instead." );
+                                                  + "Please use the <fileSets/> sub-element of <moduleSources/> instead." );
             }
             else if ( !sources.isUseDefaultExcludes() )
             {
                 getLogger().warn( "[DEPRECATION] Use of directoryMode, fileMode, or useDefaultExcludes "
-                                  + "elements directly within <moduleSources/> are all deprecated. "
-                                  + "Please use the <fileSets/> sub-element of <moduleSources/> instead." );
+                                                  + "elements directly within <moduleSources/> are all deprecated. "
+                                                  + "Please use the <fileSets/> sub-element of <moduleSources/> instead." );
             }
         }
     }
 
-    protected void addModuleBinaries( ModuleBinaries binaries, Set projects, Archiver archiver,
-                                      AssemblerConfigurationSource configSource, AssemblyContext context )
-    throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException
+    protected void addModuleBinaries( final ModuleBinaries binaries, final Set<MavenProject> projects,
+                                      final Archiver archiver, final AssemblerConfigurationSource configSource,
+                                      final AssemblyContext context )
+        throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException
     {
         if ( binaries == null )
         {
             return;
         }
 
-        Set moduleProjects = new HashSet( projects );
+        final Set<MavenProject> moduleProjects = new HashSet<MavenProject>( projects );
 
-        for ( Iterator it = moduleProjects.iterator(); it.hasNext(); )
+        for ( final Iterator<MavenProject> it = moduleProjects.iterator(); it.hasNext(); )
         {
-            MavenProject project = ( MavenProject ) it.next();
+            final MavenProject project = it.next();
 
             if ( "pom".equals( project.getPackaging() ) )
             {
-                String projectId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
+                final String projectId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
 
                 getLogger().debug( "Excluding POM-packaging module: " + projectId );
 
@@ -196,13 +175,13 @@ implements AssemblyArchiverPhase
             }
         }
 
-        String classifier = binaries.getAttachmentClassifier();
+        final String classifier = binaries.getAttachmentClassifier();
 
-        Map chosenModuleArtifacts = new HashMap();
+        final Map<MavenProject, Artifact> chosenModuleArtifacts = new HashMap<MavenProject, Artifact>();
 
-        for ( Iterator j = moduleProjects.iterator(); j.hasNext(); )
+        for ( final Iterator<MavenProject> j = moduleProjects.iterator(); j.hasNext(); )
         {
-            MavenProject project = ( MavenProject ) j.next();
+            final MavenProject project = j.next();
 
             Artifact artifact = null;
 
@@ -214,14 +193,16 @@ implements AssemblyArchiverPhase
             }
             else
             {
-                getLogger().debug( "Processing binary attachment: " + classifier + " for module project: " + project.getId() );
+                getLogger().debug( "Processing binary attachment: " + classifier + " for module project: "
+                                                   + project.getId() );
 
-                List attachments = project.getAttachedArtifacts();
+                @SuppressWarnings( "unchecked" )
+                final List<Artifact> attachments = project.getAttachedArtifacts();
                 if ( ( attachments != null ) && !attachments.isEmpty() )
                 {
-                    for ( Iterator attachmentIterator = attachments.iterator(); attachmentIterator.hasNext(); )
+                    for ( final Iterator<Artifact> attachmentIterator = attachments.iterator(); attachmentIterator.hasNext(); )
                     {
-                        Artifact attachment = (Artifact) attachmentIterator.next();
+                        final Artifact attachment = attachmentIterator.next();
 
                         if ( classifier.equals( attachment.getClassifier() ) )
                         {
@@ -233,7 +214,9 @@ implements AssemblyArchiverPhase
 
                 if ( artifact == null )
                 {
-                    throw new InvalidAssemblerConfigurationException( "Cannot find attachment with classifier: " + classifier + " in module project: " + project.getId() + ". Please exclude this module from the module-set." );
+                    throw new InvalidAssemblerConfigurationException( "Cannot find attachment with classifier: "
+                                    + classifier + " in module project: " + project.getId()
+                                    + ". Please exclude this module from the module-set." );
                 }
             }
 
@@ -241,34 +224,34 @@ implements AssemblyArchiverPhase
             addModuleArtifact( artifact, project, archiver, configSource, binaries );
         }
 
-        List depSets = getDependencySets( binaries );
+        final List<DependencySet> depSets = getDependencySets( binaries );
 
         if ( depSets != null )
         {
-            for ( Iterator it = depSets.iterator(); it.hasNext(); )
+            for ( final Iterator<DependencySet> it = depSets.iterator(); it.hasNext(); )
             {
-                DependencySet ds = (DependencySet) it.next();
+                final DependencySet ds = it.next();
 
                 // NOTE: Disabling useProjectArtifact flag, since module artifact has already been handled!
                 ds.setUseProjectArtifact( false );
             }
 
             // FIXME: This will produce unpredictable results when module dependencies have a version conflict.
-            getLogger().warn(
-                             "NOTE: Currently, inclusion of module dependencies may produce unpredictable "
-                             + "results if a version conflict occurs." );
+            getLogger().warn( "NOTE: Currently, inclusion of module dependencies may produce unpredictable "
+                                              + "results if a version conflict occurs." );
 
-            for ( Iterator it = moduleProjects.iterator(); it.hasNext(); )
+            for ( final Iterator<MavenProject> it = moduleProjects.iterator(); it.hasNext(); )
             {
-                MavenProject moduleProject = ( MavenProject ) it.next();
+                final MavenProject moduleProject = it.next();
 
                 getLogger().debug( "Processing binary dependencies for module project: " + moduleProject.getId() );
 
-                AddDependencySetsTask task =
-                    new AddDependencySetsTask( depSets, moduleProject, context.getManagedVersionMap(), projectBuilder, dependencyResolver, getLogger() );
+                final AddDependencySetsTask task =
+                    new AddDependencySetsTask( depSets, context.getResolvedArtifacts(), moduleProject, projectBuilder,
+                                               getLogger() );
 
                 task.setModuleProject( moduleProject );
-                task.setModuleArtifact( (Artifact) chosenModuleArtifacts.get( moduleProject ) );
+                task.setModuleArtifact( chosenModuleArtifacts.get( moduleProject ) );
                 task.setDefaultOutputDirectory( binaries.getOutputDirectory() );
                 task.setDefaultOutputFileNameMapping( binaries.getOutputFileNameMapping() );
 
@@ -277,13 +260,13 @@ implements AssemblyArchiverPhase
         }
     }
 
-    public static List getDependencySets( ModuleBinaries binaries )
+    public static List<DependencySet> getDependencySets( final ModuleBinaries binaries )
     {
-        List depSets = binaries.getDependencySets();
+        List<DependencySet> depSets = binaries.getDependencySets();
 
         if ( ( ( depSets == null ) || depSets.isEmpty() ) && binaries.isIncludeDependencies() )
         {
-            DependencySet impliedDependencySet = new DependencySet();
+            final DependencySet impliedDependencySet = new DependencySet();
 
             impliedDependencySet.setOutputDirectory( binaries.getOutputDirectory() );
             impliedDependencySet.setOutputFileNameMapping( binaries.getOutputFileNameMapping() );
@@ -300,39 +283,40 @@ implements AssemblyArchiverPhase
         return depSets;
     }
 
-    protected List collectExcludesFromQueuedArtifacts( Set visitedArtifacts, List binaryExcludes )
-    {
-        List excludes = binaryExcludes;
-
-        if ( excludes == null )
-        {
-            excludes = new ArrayList();
-        }
-        else
-        {
-            excludes = new ArrayList( excludes );
-        }
-
-        for ( Iterator it = visitedArtifacts.iterator(); it.hasNext(); )
-        {
-            excludes.add( it.next() );
-        }
-
-        return excludes;
-    }
-
-    protected void addModuleArtifact( Artifact artifact, MavenProject project, Archiver archiver,
-                                      AssemblerConfigurationSource configSource, ModuleBinaries binaries )
-    throws ArchiveCreationException, AssemblyFormattingException
+    // protected List<String> collectExcludesFromQueuedArtifacts( final Set visitedArtifacts, final List binaryExcludes
+    // )
+    // {
+    // List excludes = binaryExcludes;
+    //
+    // if ( excludes == null )
+    // {
+    // excludes = new ArrayList();
+    // }
+    // else
+    // {
+    // excludes = new ArrayList( excludes );
+    // }
+    //
+    // for ( final Iterator it = visitedArtifacts.iterator(); it.hasNext(); )
+    // {
+    // excludes.add( it.next() );
+    // }
+    //
+    // return excludes;
+    // }
+
+    protected void addModuleArtifact( final Artifact artifact, final MavenProject project, final Archiver archiver,
+                                      final AssemblerConfigurationSource configSource, final ModuleBinaries binaries )
+        throws ArchiveCreationException, AssemblyFormattingException
     {
         if ( artifact.getFile() == null )
         {
             throw new ArchiveCreationException( "Artifact: " + artifact.getId()
-                                                + " (included by module) does not have an artifact with a file. "
-                                                + "Please ensure the package phase is run before the assembly is generated." );
+                            + " (included by module) does not have an artifact with a file. "
+                            + "Please ensure the package phase is run before the assembly is generated." );
         }
 
-        AddArtifactTask task = new AddArtifactTask( artifact, getLogger() );
+        final AddArtifactTask task = new AddArtifactTask( artifact, getLogger() );
 
         task.setFileNameMapping( binaries.getOutputFileNameMapping() );
         task.setOutputDirectory( binaries.getOutputDirectory() );
@@ -340,13 +324,13 @@ implements AssemblyArchiverPhase
         task.setModuleProject( project );
         task.setModuleArtifact( artifact );
 
-        int dirMode = TypeConversionUtils.modeToInt( binaries.getDirectoryMode(), getLogger() );
+        final int dirMode = TypeConversionUtils.modeToInt( binaries.getDirectoryMode(), getLogger() );
         if ( dirMode != -1 )
         {
             task.setDirectoryMode( dirMode );
         }
 
-        int fileMode = TypeConversionUtils.modeToInt( binaries.getFileMode(), getLogger() );
+        final int fileMode = TypeConversionUtils.modeToInt( binaries.getFileMode(), getLogger() );
         if ( fileMode != -1 )
         {
             task.setFileMode( fileMode );
@@ -356,27 +340,29 @@ implements AssemblyArchiverPhase
 
         if ( binaries.isUnpack() && binaries.getUnpackOptions() != null )
         {
-            task.setIncludes( binaries.getUnpackOptions().getIncludes() );
-            task.setExcludes( binaries.getUnpackOptions().getExcludes() );
+            task.setIncludes( binaries.getUnpackOptions()
+                                      .getIncludes() );
+            task.setExcludes( binaries.getUnpackOptions()
+                                      .getExcludes() );
         }
 
         task.execute( archiver, configSource );
     }
 
-    protected void addModuleSourceFileSets( ModuleSources sources, Set moduleProjects, Archiver archiver,
-                                            AssemblerConfigurationSource configSource )
-    throws ArchiveCreationException, AssemblyFormattingException
+    protected void addModuleSourceFileSets( final ModuleSources sources, final Set<MavenProject> moduleProjects,
+                                            final Archiver archiver, final AssemblerConfigurationSource configSource )
+        throws ArchiveCreationException, AssemblyFormattingException
     {
         if ( sources == null )
         {
             return;
         }
 
-        List fileSets = new ArrayList();
+        final List<FileSet> fileSets = new ArrayList<FileSet>();
 
         if ( isDeprecatedModuleSourcesConfigPresent( sources ) )
         {
-            FileSet fs = new FileSet();
+            final FileSet fs = new FileSet();
             fs.setOutputDirectory( sources.getOutputDirectory() );
             fs.setIncludes( sources.getIncludes() );
             fs.setExcludes( sources.getExcludes() );
@@ -385,11 +371,11 @@ implements AssemblyArchiverPhase
             fileSets.add( fs );
         }
 
-        List subFileSets = sources.getFileSets();
+        List<FileSet> subFileSets = sources.getFileSets();
 
         if ( ( subFileSets == null ) || subFileSets.isEmpty() )
         {
-            FileSet fs = new FileSet();
+            final FileSet fs = new FileSet();
             fs.setDirectory( "src" );
 
             subFileSets = Collections.singletonList( fs );
@@ -397,22 +383,22 @@ implements AssemblyArchiverPhase
 
         fileSets.addAll( subFileSets );
 
-        for ( Iterator j = moduleProjects.iterator(); j.hasNext(); )
+        for ( final Iterator<MavenProject> j = moduleProjects.iterator(); j.hasNext(); )
         {
-            MavenProject moduleProject = ( MavenProject ) j.next();
+            final MavenProject moduleProject = j.next();
 
             getLogger().info( "Processing sources for module project: " + moduleProject.getId() );
 
-            List moduleFileSets = new ArrayList();
+            final List<FileSet> moduleFileSets = new ArrayList<FileSet>();
 
-            for ( Iterator fsIterator = fileSets.iterator(); fsIterator.hasNext(); )
+            for ( final Iterator<FileSet> fsIterator = fileSets.iterator(); fsIterator.hasNext(); )
             {
-                FileSet fileSet = ( FileSet ) fsIterator.next();
+                final FileSet fileSet = fsIterator.next();
 
                 moduleFileSets.add( createFileSet( fileSet, sources, moduleProject, configSource ) );
             }
 
-            AddFileSetsTask task = new AddFileSetsTask( moduleFileSets );
+            final AddFileSetsTask task = new AddFileSetsTask( moduleFileSets );
 
             task.setProject( moduleProject );
             task.setModuleProject( moduleProject );
@@ -425,7 +411,7 @@ implements AssemblyArchiverPhase
     /**
      * Determine whether the deprecated file-set configuration directly within the ModuleSources object is present.
      */
-    protected boolean isDeprecatedModuleSourcesConfigPresent( ModuleSources sources )
+    protected boolean isDeprecatedModuleSourcesConfigPresent( final ModuleSources sources )
     {
         boolean result = false;
 
@@ -433,11 +419,13 @@ implements AssemblyArchiverPhase
         {
             result = true;
         }
-        else if ( ( sources.getIncludes() != null ) && !sources.getIncludes().isEmpty() )
+        else if ( ( sources.getIncludes() != null ) && !sources.getIncludes()
+                                                               .isEmpty() )
         {
             result = true;
         }
-        else if ( ( sources.getExcludes() != null ) && !sources.getExcludes().isEmpty() )
+        else if ( ( sources.getExcludes() != null ) && !sources.getExcludes()
+                                                               .isEmpty() )
         {
             result = true;
         }
@@ -445,18 +433,19 @@ implements AssemblyArchiverPhase
         return result;
     }
 
-    protected FileSet createFileSet( FileSet fileSet, ModuleSources sources, MavenProject moduleProject, AssemblerConfigurationSource configSource )
-    throws AssemblyFormattingException
+    protected FileSet createFileSet( final FileSet fileSet, final ModuleSources sources,
+                                     final MavenProject moduleProject, final AssemblerConfigurationSource configSource )
+        throws AssemblyFormattingException
     {
-        FileSet fs = new FileSet();
+        final FileSet fs = new FileSet();
 
         String sourcePath = fileSet.getDirectory();
 
-        File moduleBasedir = moduleProject.getBasedir();
+        final File moduleBasedir = moduleProject.getBasedir();
 
         if ( sourcePath != null )
         {
-            File sourceDir = new File( sourcePath );
+            final File sourceDir = new File( sourcePath );
 
             if ( !sourceDir.isAbsolute() )
             {
@@ -471,9 +460,9 @@ implements AssemblyArchiverPhase
         fs.setDirectory( sourcePath );
         fs.setDirectoryMode( fileSet.getDirectoryMode() );
 
-        List excludes = new ArrayList();
+        final List<String> excludes = new ArrayList<String>();
 
-        List originalExcludes = fileSet.getExcludes();
+        final List<String> originalExcludes = fileSet.getExcludes();
         if ( ( originalExcludes != null ) && !originalExcludes.isEmpty() )
         {
             excludes.addAll( originalExcludes );
@@ -481,10 +470,11 @@ implements AssemblyArchiverPhase
 
         if ( sources.isExcludeSubModuleDirectories() )
         {
-            List modules = moduleProject.getModules();
-            for ( Iterator moduleIterator = modules.iterator(); moduleIterator.hasNext(); )
+            @SuppressWarnings( "unchecked" )
+            final List<String> modules = moduleProject.getModules();
+            for ( final Iterator<String> moduleIterator = modules.iterator(); moduleIterator.hasNext(); )
             {
-                String moduleSubPath = ( String ) moduleIterator.next();
+                final String moduleSubPath = moduleIterator.next();
 
                 excludes.add( moduleSubPath + "/**" );
             }
@@ -523,8 +513,8 @@ implements AssemblyArchiverPhase
         }
 
         destPath =
-            AssemblyFormatUtils.getOutputDirectory( destPath, configSource.getProject(), moduleProject,
-                                                    moduleProject, configSource.getFinalName(), configSource );
+            AssemblyFormatUtils.getOutputDirectory( destPath, configSource.getProject(), moduleProject, moduleProject,
+                                                    configSource.getFinalName(), configSource );
 
         fs.setOutputDirectory( destPath );
 
@@ -534,20 +524,23 @@ implements AssemblyArchiverPhase
         return fs;
     }
 
-    public static Set getModuleProjects( ModuleSet moduleSet, AssemblerConfigurationSource configSource, Logger logger )
-    throws ArchiveCreationException
+    public static Set<MavenProject> getModuleProjects( final ModuleSet moduleSet,
+                                                       final AssemblerConfigurationSource configSource,
+                                                       final Logger logger )
+        throws ArchiveCreationException
     {
         MavenProject project = configSource.getProject();
-        Set moduleProjects = null;
+        Set<MavenProject> moduleProjects = null;
 
         if ( moduleSet.isUseAllReactorProjects() )
         {
             if ( !moduleSet.isIncludeSubModules() )
             {
-                moduleProjects = new HashSet( configSource.getReactorProjects() );
+                moduleProjects = new HashSet<MavenProject>( configSource.getReactorProjects() );
             }
 
-            project = (MavenProject) configSource.getReactorProjects().get( 0 );
+            project = configSource.getReactorProjects()
+                                  .get( 0 );
         }
 
         if ( moduleProjects == null )
@@ -558,10 +551,10 @@ implements AssemblyArchiverPhase
                     ProjectUtils.getProjectModules( project, configSource.getReactorProjects(),
                                                     moduleSet.isIncludeSubModules(), logger );
             }
-            catch ( IOException e )
+            catch ( final IOException e )
             {
                 throw new ArchiveCreationException( "Error retrieving module-set for project: " + project.getId()
-                                                    + ": " + e.getMessage(), e );
+                                + ": " + e.getMessage(), e );
             }
         }
 

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhase.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhase.java?rev=999612&r1=999611&r2=999612&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhase.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhase.java Tue Sep 21 20:34:50 2010
@@ -19,102 +19,74 @@ package org.apache.maven.plugin.assembly
  * under the License.
  */
 
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugin.assembly.AssemblyContext;
-import org.apache.maven.plugin.assembly.DefaultAssemblyContext;
 import org.apache.maven.plugin.assembly.InvalidAssemblerConfigurationException;
 import org.apache.maven.plugin.assembly.archive.ArchiveCreationException;
 import org.apache.maven.plugin.assembly.archive.phase.wrappers.RepoBuilderConfigSourceWrapper;
 import org.apache.maven.plugin.assembly.archive.phase.wrappers.RepoInfoWrapper;
 import org.apache.maven.plugin.assembly.archive.task.AddDirectoryTask;
-import org.apache.maven.plugin.assembly.artifact.DependencyResolver;
 import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
 import org.apache.maven.plugin.assembly.model.Assembly;
 import org.apache.maven.plugin.assembly.model.Repository;
 import org.apache.maven.plugin.assembly.utils.AssemblyFormatUtils;
 import org.apache.maven.plugin.assembly.utils.TypeConversionUtils;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.artifact.InvalidDependencyVersionException;
 import org.apache.maven.shared.repository.RepositoryAssembler;
 import org.apache.maven.shared.repository.RepositoryAssemblyException;
 import org.apache.maven.shared.repository.RepositoryBuilderConfigSource;
 import org.apache.maven.shared.repository.model.RepositoryInfo;
 import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 
 import java.io.File;
 import java.util.Iterator;
-import java.util.LinkedHashSet;
 import java.util.List;
-import java.util.Set;
 
 /**
  * @version $Id$
- * @plexus.component role="org.apache.maven.plugin.assembly.archive.phase.AssemblyArchiverPhase"
- *                   role-hint="repositories"
  */
+@Component( role = AssemblyArchiverPhase.class, hint = "repositories" )
 public class RepositoryAssemblyPhase
     extends AbstractLogEnabled
     implements AssemblyArchiverPhase
 {
 
-    /**
-     * @plexus.requirement
-     */
+    @Requirement
     private RepositoryAssembler repositoryAssembler;
 
-    /**
-     * @plexus.requirement
-     */
-    private DependencyResolver dependencyResolver;
-
     public RepositoryAssemblyPhase()
     {
         // used for plexus.
     }
 
     // introduced for testing.
-    public RepositoryAssemblyPhase( RepositoryAssembler repositoryAssembler, DependencyResolver resolver )
+    public RepositoryAssemblyPhase( final RepositoryAssembler repositoryAssembler )
     {
         this.repositoryAssembler = repositoryAssembler;
-        dependencyResolver = resolver;
     }
 
     /**
      * {@inheritDoc}
      */
-    public void execute( Assembly assembly, Archiver archiver, AssemblerConfigurationSource configSource )
+    public void execute( final Assembly assembly, final Archiver archiver,
+                         final AssemblerConfigurationSource configSource, final AssemblyContext context )
         throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException
     {
-        execute( assembly, archiver, configSource, new DefaultAssemblyContext() );
-    }
+        final List<Repository> repositoriesList = assembly.getRepositories();
 
-    /**
-     * {@inheritDoc}
-     */
-    public void execute( Assembly assembly, Archiver archiver, AssemblerConfigurationSource configSource,
-                         AssemblyContext context )
-        throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException
-    {
-        List repositoriesList = assembly.getRepositories();
+        final File tempRoot = configSource.getTemporaryRootDirectory();
 
-        File tempRoot = configSource.getTemporaryRootDirectory();
-
-        for ( Iterator i = repositoriesList.iterator(); i.hasNext(); )
+        for ( final Iterator<Repository> i = repositoriesList.iterator(); i.hasNext(); )
         {
-            Repository repository = (Repository) i.next();
-
-            resolveDependencies( repository, configSource, context );
+            final Repository repository = i.next();
 
-            String outputDirectory =
+            final String outputDirectory =
                 AssemblyFormatUtils.getOutputDirectory( repository.getOutputDirectory(), configSource.getProject(),
-                                                        null, configSource.getFinalName(),
-                                                        configSource );
+                                                        null, configSource.getFinalName(), configSource );
 
-            File repositoryDirectory = new File( tempRoot, outputDirectory );
+            final File repositoryDirectory = new File( tempRoot, outputDirectory );
 
             if ( !repositoryDirectory.exists() )
             {
@@ -127,25 +99,25 @@ public class RepositoryAssemblyPhase
                 repositoryAssembler.buildRemoteRepository( repositoryDirectory, wrap( repository ), wrap( configSource ) );
                 getLogger().debug( "Finished assembling repository to: " + repositoryDirectory );
             }
-            catch ( RepositoryAssemblyException e )
+            catch ( final RepositoryAssemblyException e )
             {
                 throw new ArchiveCreationException( "Failed to assemble repository: " + e.getMessage(), e );
             }
 
-            AddDirectoryTask task = new AddDirectoryTask( repositoryDirectory );
+            final AddDirectoryTask task = new AddDirectoryTask( repositoryDirectory );
 
-            int dirMode = TypeConversionUtils.modeToInt( repository.getDirectoryMode(), getLogger() );
+            final int dirMode = TypeConversionUtils.modeToInt( repository.getDirectoryMode(), getLogger() );
             if ( dirMode != -1 )
             {
                 task.setDirectoryMode( dirMode );
             }
-            
-            int fileMode = TypeConversionUtils.modeToInt( repository.getFileMode(), getLogger() );
+
+            final int fileMode = TypeConversionUtils.modeToInt( repository.getFileMode(), getLogger() );
             if ( fileMode != -1 )
             {
                 task.setFileMode( fileMode );
             }
-            
+
             task.setUseDefaultExcludes( repository.isUseDefaultExcludes() );
             task.setOutputDirectory( outputDirectory );
 
@@ -153,51 +125,12 @@ public class RepositoryAssemblyPhase
         }
     }
 
-    private void resolveDependencies( Repository repository, AssemblerConfigurationSource configSource,
-                                      AssemblyContext context )
-        throws ArchiveCreationException
-    {
-        MavenProject project = configSource.getProject();
-
-        ArtifactRepository localRepository = configSource.getLocalRepository();
-
-        List additionalRemoteRepositories = configSource.getRemoteRepositories();
-
-        Set dependencyArtifacts;
-        try
-        {
-            // NOTE: hard-coding to resolve artifacts transitively, since this is meant to be a self-contained repository...
-            dependencyArtifacts =
-                dependencyResolver.resolveDependencies( project, repository.getScope(), context.getManagedVersionMap(),
-                                                        localRepository, additionalRemoteRepositories, true );
-
-            if ( ( dependencyArtifacts != null ) && !dependencyArtifacts.isEmpty() )
-            {
-                dependencyArtifacts = new LinkedHashSet( dependencyArtifacts );
-            }
-        }
-        catch ( ArtifactResolutionException e )
-        {
-            throw new ArchiveCreationException( "Failed to resolve dependencies for project: " + project.getId(), e );
-        }
-        catch ( ArtifactNotFoundException e )
-        {
-            throw new ArchiveCreationException( "Failed to resolve dependencies for project: " + project.getId(), e );
-        }
-        catch ( InvalidDependencyVersionException e )
-        {
-            throw new ArchiveCreationException( "Failed to resolve dependencies for project: " + project.getId(), e );
-        }
-
-        project.setDependencyArtifacts( dependencyArtifacts );
-    }
-
-    private RepositoryBuilderConfigSource wrap( AssemblerConfigurationSource configSource )
+    private RepositoryBuilderConfigSource wrap( final AssemblerConfigurationSource configSource )
     {
         return new RepoBuilderConfigSourceWrapper( configSource );
     }
 
-    private RepositoryInfo wrap( Repository repository )
+    private RepositoryInfo wrap( final Repository repository )
     {
         return new RepoInfoWrapper( repository );
     }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/wrappers/GroupVersionAlignmentWrapper.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/wrappers/GroupVersionAlignmentWrapper.java?rev=999612&r1=999611&r2=999612&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/wrappers/GroupVersionAlignmentWrapper.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/wrappers/GroupVersionAlignmentWrapper.java Tue Sep 21 20:34:50 2010
@@ -32,12 +32,12 @@ public class GroupVersionAlignmentWrappe
 
     private final GroupVersionAlignment alignment;
 
-    public GroupVersionAlignmentWrapper( GroupVersionAlignment alignment )
+    public GroupVersionAlignmentWrapper( final GroupVersionAlignment alignment )
     {
         this.alignment = alignment;
     }
 
-    public List getExcludes()
+    public List<String> getExcludes()
     {
         return alignment.getExcludes();
     }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/wrappers/RepoInfoWrapper.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/wrappers/RepoInfoWrapper.java?rev=999612&r1=999611&r2=999612&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/wrappers/RepoInfoWrapper.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/wrappers/RepoInfoWrapper.java Tue Sep 21 20:34:50 2010
@@ -35,29 +35,31 @@ public class RepoInfoWrapper
 {
 
     private final Repository repo;
-    private List convertedAlignments;
 
-    public RepoInfoWrapper( Repository repo )
+    private List<GroupVersionAlignmentWrapper> convertedAlignments;
+
+    public RepoInfoWrapper( final Repository repo )
     {
         this.repo = repo;
     }
 
-    public List getExcludes()
+    public List<String> getExcludes()
     {
         return repo.getExcludes();
     }
 
-    public List getGroupVersionAlignments()
+    public List<GroupVersionAlignmentWrapper> getGroupVersionAlignments()
     {
-        List alignments = repo.getGroupVersionAlignments();
+        final List<GroupVersionAlignment> alignments = repo.getGroupVersionAlignments();
 
         if ( convertedAlignments == null || alignments.size() != convertedAlignments.size() )
         {
-            List l = new ArrayList( alignments.size() );
+            final List<GroupVersionAlignmentWrapper> l =
+                new ArrayList<GroupVersionAlignmentWrapper>( alignments.size() );
 
-            for ( Iterator it = alignments.iterator(); it.hasNext(); )
+            for ( final Iterator<GroupVersionAlignment> it = alignments.iterator(); it.hasNext(); )
             {
-                GroupVersionAlignment alignment = (GroupVersionAlignment) it.next();
+                final GroupVersionAlignment alignment = it.next();
 
                 l.add( new GroupVersionAlignmentWrapper( alignment ) );
             }
@@ -68,7 +70,7 @@ public class RepoInfoWrapper
         return convertedAlignments;
     }
 
-    public List getIncludes()
+    public List<String> getIncludes()
     {
         return repo.getIncludes();
     }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTask.java?rev=999612&r1=999611&r2=999612&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTask.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTask.java Tue Sep 21 20:34:50 2010
@@ -51,16 +51,16 @@ public class AddArtifactTask
 
     private boolean unpack = false;
 
-    private List includes;
+    private List<String> includes;
 
-    private List excludes;
+    private List<String> excludes;
 
     private final Artifact artifact;
 
     private MavenProject project;
-    
+
     private MavenProject moduleProject;
-    
+
     private Artifact moduleArtifact;
 
     private String outputDirectory;
@@ -69,33 +69,36 @@ public class AddArtifactTask
 
     private final Logger logger;
 
-    public AddArtifactTask( Artifact artifact, Logger logger )
+    public AddArtifactTask( final Artifact artifact, final Logger logger )
     {
         this.artifact = artifact;
         this.logger = logger;
     }
 
-    public void execute( Archiver archiver, AssemblerConfigurationSource configSource )
+    public void execute( final Archiver archiver, final AssemblerConfigurationSource configSource )
         throws ArchiveCreationException, AssemblyFormattingException
     {
-        // MASSEMBLY-282: We should support adding a project's standard output file as part of an assembly that replaces it.
-        if ( ( ( artifact.getFile() != null )  &&  ( archiver.getDestFile() != null ) )
-                        && artifact.getFile().equals( archiver.getDestFile() ) )
+        // MASSEMBLY-282: We should support adding a project's standard output file as part of an assembly that replaces
+        // it.
+        if ( ( ( artifact.getFile() != null ) && ( archiver.getDestFile() != null ) )
+                        && artifact.getFile()
+                                   .equals( archiver.getDestFile() ) )
         {
-            File tempRoot = configSource.getTemporaryRootDirectory();
-            File tempArtifactFile = new File( tempRoot, artifact.getFile().getName() );
+            final File tempRoot = configSource.getTemporaryRootDirectory();
+            final File tempArtifactFile = new File( tempRoot, artifact.getFile()
+                                                                      .getName() );
 
             logger.warn( "Artifact: "
-                         + artifact.getId()
-                         + " references the same file as the assembly destination file. Moving it to a temporary location for inclusion." );
+                            + artifact.getId()
+                            + " references the same file as the assembly destination file. Moving it to a temporary location for inclusion." );
             try
             {
                 FileUtils.copyFile( artifact.getFile(), tempArtifactFile );
             }
-            catch ( IOException e )
+            catch ( final IOException e )
             {
-                throw new ArchiveCreationException( "Error moving artifact file: '" + artifact.getFile() + "' to temporary location: " + tempArtifactFile + ". Reason: "
-                                                    + e.getMessage(), e );
+                throw new ArchiveCreationException( "Error moving artifact file: '" + artifact.getFile()
+                                + "' to temporary location: " + tempArtifactFile + ". Reason: " + e.getMessage(), e );
             }
 
             artifact.setFile( tempArtifactFile );
@@ -103,7 +106,9 @@ public class AddArtifactTask
 
         String destDirectory = outputDirectory;
 
-        destDirectory = AssemblyFormatUtils.getOutputDirectory( destDirectory, configSource.getProject(), moduleProject, project, configSource.getFinalName(), configSource );
+        destDirectory =
+            AssemblyFormatUtils.getOutputDirectory( destDirectory, configSource.getProject(), moduleProject, project,
+                                                    configSource.getFinalName(), configSource );
 
         if ( unpack )
         {
@@ -119,16 +124,16 @@ public class AddArtifactTask
             {
                 includesArray = DEFAULT_INCLUDES_ARRAY;
             }
-            String[] excludesArray = TypeConversionUtils.toStringArray( excludes );
+            final String[] excludesArray = TypeConversionUtils.toStringArray( excludes );
 
-            int oldDirMode = archiver.getOverrideDirectoryMode();
-            int oldFileMode = archiver.getOverrideFileMode();
+            final int oldDirMode = archiver.getOverrideDirectoryMode();
+            final int oldFileMode = archiver.getOverrideFileMode();
 
             logger.debug( "Unpacking artifact: " + artifact.getId() + " to assembly location: " + outputLocation + "." );
 
             boolean fileModeSet = false;
             boolean dirModeSet = false;
-            
+
             try
             {
                 if ( fileMode != -1 )
@@ -143,10 +148,11 @@ public class AddArtifactTask
                     dirModeSet = true;
                 }
 
-                File artifactFile = artifact.getFile();
+                final File artifactFile = artifact.getFile();
                 if ( artifactFile == null )
                 {
-                    logger.warn( "Skipping artifact: " + artifact.getId() + "; it does not have an associated file or directory." );
+                    logger.warn( "Skipping artifact: " + artifact.getId()
+                                    + "; it does not have an associated file or directory." );
                 }
                 else if ( artifactFile.isDirectory() )
                 {
@@ -157,14 +163,16 @@ public class AddArtifactTask
                 {
                     logger.debug( "Unpacking artifact contents for: " + artifact + " to: " + outputLocation );
                     logger.debug( "includes:\n" + StringUtils.join( includesArray, "\n" ) + "\n" );
-                    logger.debug( "excludes:\n" + (excludesArray == null ? "none" : StringUtils.join( excludesArray, "\n" ) ) + "\n" );
+                    logger.debug( "excludes:\n"
+                                    + ( excludesArray == null ? "none" : StringUtils.join( excludesArray, "\n" ) )
+                                    + "\n" );
                     archiver.addArchivedFileSet( artifactFile, outputLocation, includesArray, excludesArray );
                 }
             }
-            catch ( ArchiverException e )
+            catch ( final ArchiverException e )
             {
                 throw new ArchiveCreationException( "Error adding file-set for '" + artifact.getId() + "' to archive: "
-                    + e.getMessage(), e );
+                                + e.getMessage(), e );
             }
             finally
             {
@@ -172,7 +180,7 @@ public class AddArtifactTask
                 {
                     archiver.setDirectoryMode( oldDirMode );
                 }
-                
+
                 if ( fileModeSet )
                 {
                     archiver.setFileMode( oldFileMode );
@@ -181,18 +189,19 @@ public class AddArtifactTask
         }
         else
         {
-            String fileNameMapping =
+            final String fileNameMapping =
                 AssemblyFormatUtils.evaluateFileNameMapping( outputFileNameMapping, artifact,
                                                              configSource.getProject(), moduleProject, moduleArtifact,
                                                              project, configSource );
 
-            String outputLocation = destDirectory + fileNameMapping;
+            final String outputLocation = destDirectory + fileNameMapping;
 
             try
             {
-                File artifactFile = artifact.getFile();
+                final File artifactFile = artifact.getFile();
 
-                logger.debug( "Adding artifact: " + artifact.getId() + " with file: " + artifactFile + " to assembly location: " + outputLocation + "." );
+                logger.debug( "Adding artifact: " + artifact.getId() + " with file: " + artifactFile
+                                + " to assembly location: " + outputLocation + "." );
 
                 if ( fileMode != -1 )
                 {
@@ -203,60 +212,60 @@ public class AddArtifactTask
                     archiver.addFile( artifactFile, outputLocation );
                 }
             }
-            catch ( ArchiverException e )
+            catch ( final ArchiverException e )
             {
                 throw new ArchiveCreationException( "Error adding file '" + artifact.getId() + "' to archive: "
-                    + e.getMessage(), e );
+                                + e.getMessage(), e );
             }
         }
     }
 
-    public void setDirectoryMode( int directoryMode )
+    public void setDirectoryMode( final int directoryMode )
     {
         this.directoryMode = directoryMode;
     }
 
-    public void setFileMode( int fileMode )
+    public void setFileMode( final int fileMode )
     {
         this.fileMode = fileMode;
     }
 
-    public void setExcludes( List excludes )
+    public void setExcludes( final List<String> excludes )
     {
         this.excludes = excludes;
     }
 
-    public void setIncludes( List includes )
+    public void setIncludes( final List<String> includes )
     {
         this.includes = includes;
     }
 
-    public void setUnpack( boolean unpack )
+    public void setUnpack( final boolean unpack )
     {
         this.unpack = unpack;
     }
 
-    public void setProject( MavenProject project )
+    public void setProject( final MavenProject project )
     {
         this.project = project;
     }
 
-    public void setOutputDirectory( String outputDirectory )
+    public void setOutputDirectory( final String outputDirectory )
     {
         this.outputDirectory = outputDirectory;
     }
 
-    public void setFileNameMapping( String outputFileNameMapping )
+    public void setFileNameMapping( final String outputFileNameMapping )
     {
         this.outputFileNameMapping = outputFileNameMapping;
     }
 
-    public void setOutputDirectory( String outputDirectory, String defaultOutputDirectory )
+    public void setOutputDirectory( final String outputDirectory, final String defaultOutputDirectory )
     {
         setOutputDirectory( outputDirectory == null ? defaultOutputDirectory : outputDirectory );
     }
 
-    public void setFileNameMapping( String outputFileNameMapping, String defaultOutputFileNameMapping )
+    public void setFileNameMapping( final String outputFileNameMapping, final String defaultOutputFileNameMapping )
     {
         setFileNameMapping( outputFileNameMapping == null ? defaultOutputFileNameMapping : outputFileNameMapping );
     }
@@ -266,7 +275,7 @@ public class AddArtifactTask
         return moduleProject;
     }
 
-    public void setModuleProject( MavenProject moduleProject )
+    public void setModuleProject( final MavenProject moduleProject )
     {
         this.moduleProject = moduleProject;
     }
@@ -276,7 +285,7 @@ public class AddArtifactTask
         return moduleArtifact;
     }
 
-    public void setModuleArtifact( Artifact moduleArtifact )
+    public void setModuleArtifact( final Artifact moduleArtifact )
     {
         this.moduleArtifact = moduleArtifact;
     }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java?rev=999612&r1=999611&r2=999612&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java Tue Sep 21 20:34:50 2010
@@ -20,14 +20,11 @@ package org.apache.maven.plugin.assembly
  */
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.model.Dependency;
 import org.apache.maven.model.Model;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugin.assembly.InvalidAssemblerConfigurationException;
 import org.apache.maven.plugin.assembly.archive.ArchiveCreationException;
-import org.apache.maven.plugin.assembly.artifact.DependencyResolver;
 import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
 import org.apache.maven.plugin.assembly.model.DependencySet;
 import org.apache.maven.plugin.assembly.model.UnpackOptions;
@@ -37,7 +34,7 @@ import org.apache.maven.plugin.assembly.
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import org.apache.maven.shared.artifact.filter.ScopeArtifactFilter;
 import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.logging.Logger;
@@ -45,10 +42,9 @@ import org.codehaus.plexus.logging.Logge
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.Iterator;
-import java.util.LinkedHashSet;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
 /**
@@ -58,23 +54,23 @@ public class AddDependencySetsTask
     implements ArchiverTask
 {
 
-    private static final List NON_ARCHIVE_DEPENDENCY_TYPES;
+    private static final List<String> NON_ARCHIVE_DEPENDENCY_TYPES;
 
     static
     {
-        List nonArch = new ArrayList();
+        final List<String> nonArch = new ArrayList<String>();
 
         nonArch.add( "pom" );
 
         NON_ARCHIVE_DEPENDENCY_TYPES = Collections.unmodifiableList( nonArch );
     }
 
-    private final List dependencySets;
+    private final List<DependencySet> dependencySets;
 
     private final Logger logger;
 
     private final MavenProject project;
-    
+
     private MavenProject moduleProject;
 
     private final MavenProjectBuilder projectBuilder;
@@ -83,24 +79,22 @@ public class AddDependencySetsTask
 
     private String defaultOutputFileNameMapping;
 
-    private final DependencyResolver dependencyResolver;
-
-    private final Map managedVersions;
-
     private Artifact moduleArtifact;
 
-    public AddDependencySetsTask( List dependencySets, MavenProject project, Map managedVersions, MavenProjectBuilder projectBuilder,
-                                  DependencyResolver dependencyResolver, Logger logger )
+    private final Set<Artifact> resolvedArtifacts;
+
+    public AddDependencySetsTask( final List<DependencySet> dependencySets, final Set<Artifact> resolvedArtifacts,
+                                  final MavenProject project, final MavenProjectBuilder projectBuilder,
+                                  final Logger logger )
     {
         this.dependencySets = dependencySets;
+        this.resolvedArtifacts = resolvedArtifacts;
         this.project = project;
-        this.managedVersions = managedVersions;
         this.projectBuilder = projectBuilder;
-        this.dependencyResolver = dependencyResolver;
         this.logger = logger;
     }
 
-    public void execute( Archiver archiver, AssemblerConfigurationSource configSource )
+    public void execute( final Archiver archiver, final AssemblerConfigurationSource configSource )
         throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException
     {
         if ( ( dependencySets == null ) || dependencySets.isEmpty() )
@@ -109,22 +103,23 @@ public class AddDependencySetsTask
             return;
         }
 
-        List deps = project.getDependencies();
+        @SuppressWarnings( "unchecked" )
+        final List<Dependency> deps = project.getDependencies();
         if ( ( deps == null ) || deps.isEmpty() )
         {
             logger.debug( "Project " + project.getId() + " has no dependencies. Skipping dependency set addition." );
         }
 
-        for ( Iterator i = dependencySets.iterator(); i.hasNext(); )
+        for ( final Iterator<DependencySet> i = dependencySets.iterator(); i.hasNext(); )
         {
-            DependencySet dependencySet = (DependencySet) i.next();
+            final DependencySet dependencySet = i.next();
 
             addDependencySet( dependencySet, archiver, configSource );
         }
     }
 
-    protected void addDependencySet( DependencySet dependencySet, Archiver archiver,
-                                     AssemblerConfigurationSource configSource )
+    protected void addDependencySet( final DependencySet dependencySet, final Archiver archiver,
+                                     final AssemblerConfigurationSource configSource )
         throws AssemblyFormattingException, ArchiveCreationException, InvalidAssemblerConfigurationException
     {
         logger.debug( "Processing DependencySet (output=" + dependencySet.getOutputDirectory() + ")" );
@@ -132,27 +127,28 @@ public class AddDependencySetsTask
         if ( !dependencySet.isUseTransitiveDependencies() && dependencySet.isUseTransitiveFiltering() )
         {
             logger.warn( "DependencySet has nonsensical configuration: useTransitiveDependencies == false "
-                         + "AND useTransitiveFiltering == true. Transitive filtering flag will be ignored." );
+                            + "AND useTransitiveFiltering == true. Transitive filtering flag will be ignored." );
         }
 
-        Set dependencyArtifacts = resolveDependencyArtifacts( dependencySet, configSource );
+        final Set<Artifact> dependencyArtifacts = resolveDependencyArtifacts( dependencySet );
 
         logger.debug( "Adding " + dependencyArtifacts.size() + " dependency artifacts." );
 
-        for ( Iterator j = dependencyArtifacts.iterator(); j.hasNext(); )
+        for ( final Iterator<Artifact> j = dependencyArtifacts.iterator(); j.hasNext(); )
         {
-            Artifact depArtifact = (Artifact) j.next();
+            final Artifact depArtifact = j.next();
 
             MavenProject depProject;
             try
             {
-                depProject = projectBuilder.buildFromRepository( depArtifact, configSource.getRemoteRepositories(),
-                                                                 configSource.getLocalRepository() );
+                depProject =
+                    projectBuilder.buildFromRepository( depArtifact, configSource.getRemoteRepositories(),
+                                                        configSource.getLocalRepository() );
             }
-            catch ( ProjectBuildingException e )
+            catch ( final ProjectBuildingException e )
             {
-                logger.debug( "Error retrieving POM of module-dependency: " + depArtifact.getId()
-                    + "; Reason: " + e.getMessage() + "\n\nBuilding stub project instance." );
+                logger.debug( "Error retrieving POM of module-dependency: " + depArtifact.getId() + "; Reason: "
+                                + e.getMessage() + "\n\nBuilding stub project instance." );
 
                 depProject = buildProjectStub( depArtifact );
             }
@@ -163,29 +159,29 @@ public class AddDependencySetsTask
             }
             else
             {
-                AddArtifactTask task = new AddArtifactTask( depArtifact, logger );
+                final AddArtifactTask task = new AddArtifactTask( depArtifact, logger );
 
                 task.setProject( depProject );
                 task.setModuleProject( moduleProject );
                 task.setModuleArtifact( moduleArtifact );
                 task.setOutputDirectory( dependencySet.getOutputDirectory(), defaultOutputDirectory );
                 task.setFileNameMapping( dependencySet.getOutputFileNameMapping(), defaultOutputFileNameMapping );
-                
-                int dirMode = TypeConversionUtils.modeToInt( dependencySet.getDirectoryMode(), logger );
+
+                final int dirMode = TypeConversionUtils.modeToInt( dependencySet.getDirectoryMode(), logger );
                 if ( dirMode != -1 )
                 {
                     task.setDirectoryMode( dirMode );
                 }
-                
-                int fileMode = TypeConversionUtils.modeToInt( dependencySet.getFileMode(), logger );
+
+                final int fileMode = TypeConversionUtils.modeToInt( dependencySet.getFileMode(), logger );
                 if ( fileMode != -1 )
                 {
                     task.setFileMode( fileMode );
                 }
-                
+
                 task.setUnpack( dependencySet.isUnpack() );
 
-                UnpackOptions opts = dependencySet.getUnpackOptions();
+                final UnpackOptions opts = dependencySet.getUnpackOptions();
                 if ( dependencySet.isUnpack() && ( opts != null ) )
                 {
                     task.setIncludes( opts.getIncludes() );
@@ -197,9 +193,9 @@ public class AddDependencySetsTask
         }
     }
 
-    private MavenProject buildProjectStub( Artifact depArtifact )
+    private MavenProject buildProjectStub( final Artifact depArtifact )
     {
-        Model model = new Model();
+        final Model model = new Model();
         model.setGroupId( depArtifact.getGroupId() );
         model.setArtifactId( depArtifact.getArtifactId() );
         model.setVersion( depArtifact.getBaseVersion() );
@@ -210,60 +206,38 @@ public class AddDependencySetsTask
         return new MavenProject( model );
     }
 
-    protected Set resolveDependencyArtifacts( DependencySet dependencySet, AssemblerConfigurationSource configSource )
-        throws ArchiveCreationException, InvalidAssemblerConfigurationException
+    protected Set<Artifact> resolveDependencyArtifacts( final DependencySet dependencySet )
+        throws InvalidAssemblerConfigurationException
     {
-        ArtifactRepository localRepository = configSource.getLocalRepository();
-
-        List additionalRemoteRepositories = configSource.getRemoteRepositories();
-
-        Set dependencyArtifacts;
-        try
+        final Set<Artifact> dependencyArtifacts = new HashSet<Artifact>();
+        if ( resolvedArtifacts != null )
         {
-            dependencyArtifacts = dependencyResolver.resolveDependencies( project, dependencySet.getScope(),
-                                                                          managedVersions, localRepository,
-                                                                          additionalRemoteRepositories,
-                                                                          dependencySet.isUseTransitiveDependencies() );
-
-            if ( ( dependencyArtifacts != null ) && !dependencyArtifacts.isEmpty() )
-            {
-                dependencyArtifacts = new LinkedHashSet( dependencyArtifacts );
-            }
-        }
-        catch ( ArtifactResolutionException e )
-        {
-            throw new ArchiveCreationException( "Failed to resolve dependencies for project: " + project.getId(), e );
-        }
-        catch ( ArtifactNotFoundException e )
-        {
-            throw new ArchiveCreationException( "Failed to resolve dependencies for project: " + project.getId(), e );
-        }
-        catch ( InvalidDependencyVersionException e )
-        {
-            throw new ArchiveCreationException( "Failed to resolve dependencies for project: " + project.getId(), e );
+            dependencyArtifacts.addAll( resolvedArtifacts );
         }
 
         if ( dependencySet.isUseProjectArtifact() )
         {
-            Artifact projectArtifact = project.getArtifact();
+            final Artifact projectArtifact = project.getArtifact();
             if ( ( projectArtifact != null ) && ( projectArtifact.getFile() != null ) )
             {
                 dependencyArtifacts.add( projectArtifact );
             }
             else
             {
-                logger.warn( "Cannot include project artifact: " + projectArtifact + "; it doesn't have an associated file or directory." );
+                logger.warn( "Cannot include project artifact: " + projectArtifact
+                                + "; it doesn't have an associated file or directory." );
             }
         }
 
         if ( dependencySet.isUseProjectAttachments() )
         {
-            List attachments = project.getAttachedArtifacts();
+            @SuppressWarnings( "unchecked" )
+            final List<Artifact> attachments = project.getAttachedArtifacts();
             if ( attachments != null )
             {
-                for ( Iterator attachmentIt = attachments.iterator(); attachmentIt.hasNext(); )
+                for ( final Iterator<Artifact> attachmentIt = attachments.iterator(); attachmentIt.hasNext(); )
                 {
-                    Artifact attachment = (Artifact) attachmentIt.next();
+                    final Artifact attachment = attachmentIt.next();
 
                     if ( attachment.getFile() != null )
                     {
@@ -272,7 +246,7 @@ public class AddDependencySetsTask
                     else
                     {
                         logger.warn( "Cannot include attached artifact: " + project.getId() + " for project: "
-                                     + project.getId() + "; it doesn't have an associated file or directory." );
+                                        + project.getId() + "; it doesn't have an associated file or directory." );
                     }
                 }
             }
@@ -287,26 +261,30 @@ public class AddDependencySetsTask
             logger.debug( "Filtering dependency artifacts WITHOUT transitive dependency path information." );
         }
 
+        final ScopeArtifactFilter filter = new ScopeArtifactFilter( dependencySet.getScope() );
+
         FilterUtils.filterArtifacts( dependencyArtifacts, dependencySet.getIncludes(), dependencySet.getExcludes(),
                                      dependencySet.isUseStrictFiltering(), dependencySet.isUseTransitiveFiltering(),
-                                     Collections.EMPTY_LIST, logger );
+                                     logger, filter );
 
         return dependencyArtifacts;
     }
 
-    protected void addNonArchiveDependency( Artifact depArtifact, MavenProject depProject, DependencySet dependencySet,
-                                            Archiver archiver, AssemblerConfigurationSource configSource )
+    protected void addNonArchiveDependency( final Artifact depArtifact, final MavenProject depProject,
+                                            final DependencySet dependencySet, final Archiver archiver,
+                                            final AssemblerConfigurationSource configSource )
         throws AssemblyFormattingException, ArchiveCreationException
     {
-        File source = depArtifact.getFile();
+        final File source = depArtifact.getFile();
 
         String outputDirectory = dependencySet.getOutputDirectory();
 
-        outputDirectory = AssemblyFormatUtils.getOutputDirectory( outputDirectory, configSource.getProject(),
-                                                                  moduleProject, depProject, depProject.getBuild().getFinalName(),
-                                                                  configSource );
+        outputDirectory =
+            AssemblyFormatUtils.getOutputDirectory( outputDirectory, configSource.getProject(), moduleProject,
+                                                    depProject, depProject.getBuild()
+                                                                          .getFinalName(), configSource );
 
-        String destName =
+        final String destName =
             AssemblyFormatUtils.evaluateFileNameMapping( dependencySet.getOutputFileNameMapping(), depArtifact,
                                                          configSource.getProject(), moduleProject, moduleArtifact,
                                                          depProject, configSource );
@@ -325,7 +303,7 @@ public class AddDependencySetsTask
 
         try
         {
-            int mode = TypeConversionUtils.modeToInt( dependencySet.getFileMode(), logger );
+            final int mode = TypeConversionUtils.modeToInt( dependencySet.getFileMode(), logger );
             if ( mode > -1 )
             {
                 archiver.addFile( source, target, mode );
@@ -335,13 +313,13 @@ public class AddDependencySetsTask
                 archiver.addFile( source, target );
             }
         }
-        catch ( ArchiverException e )
+        catch ( final ArchiverException e )
         {
             throw new ArchiveCreationException( "Error adding file to archive: " + e.getMessage(), e );
         }
     }
 
-    public List getDependencySets()
+    public List<DependencySet> getDependencySets()
     {
         return dependencySets;
     }
@@ -356,7 +334,7 @@ public class AddDependencySetsTask
         return defaultOutputDirectory;
     }
 
-    public void setDefaultOutputDirectory( String defaultOutputDirectory )
+    public void setDefaultOutputDirectory( final String defaultOutputDirectory )
     {
         this.defaultOutputDirectory = defaultOutputDirectory;
     }
@@ -366,7 +344,7 @@ public class AddDependencySetsTask
         return defaultOutputFileNameMapping;
     }
 
-    public void setDefaultOutputFileNameMapping( String defaultOutputFileNameMapping )
+    public void setDefaultOutputFileNameMapping( final String defaultOutputFileNameMapping )
     {
         this.defaultOutputFileNameMapping = defaultOutputFileNameMapping;
     }
@@ -376,16 +354,16 @@ public class AddDependencySetsTask
         return moduleProject;
     }
 
-    public void setModuleProject( MavenProject moduleProject )
+    public void setModuleProject( final MavenProject moduleProject )
     {
         this.moduleProject = moduleProject;
     }
 
-    public void setModuleArtifact( Artifact moduleArtifact )
+    public void setModuleArtifact( final Artifact moduleArtifact )
     {
         this.moduleArtifact = moduleArtifact;
     }
-    
+
     public Artifact getModuleArtifact()
     {
         return moduleArtifact;