You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2014/10/23 23:01:38 UTC

svn commit: r1633948 [17/21] - in /maven/plugins/branches/MASSEMBLY-704: ./ integration-test-archetype/ integration-test-archetype/src/main/resources/META-INF/maven/ integration-test-archetype/src/main/resources/archetype-resources/ integration-test-ar...

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddFileSetsTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddFileSetsTask.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddFileSetsTask.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddFileSetsTask.java Thu Oct 23 21:01:23 2014
@@ -20,7 +20,6 @@ package org.apache.maven.plugin.assembly
  */
 
 import java.io.File;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -28,12 +27,13 @@ import java.util.List;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugin.assembly.archive.ArchiveCreationException;
 import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
-import org.apache.maven.plugin.assembly.format.FileSetFormatter;
+import org.apache.maven.plugin.assembly.format.ReaderFormatter;
 import org.apache.maven.plugin.assembly.model.FileSet;
 import org.apache.maven.plugin.assembly.utils.AssemblyFormatUtils;
 import org.apache.maven.plugin.assembly.utils.TypeConversionUtils;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.components.io.functions.InputStreamTransformer;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
 
@@ -41,7 +41,6 @@ import org.codehaus.plexus.logging.conso
  * @version $Id$
  */
 public class AddFileSetsTask
-    implements ArchiverTask
 {
 
     private final List<FileSet> fileSets;
@@ -77,29 +76,28 @@ public class AddFileSetsTask
             if ( !archiveBaseDir.exists() )
             {
                 throw new ArchiveCreationException( "The archive base directory '" + archiveBaseDir.getAbsolutePath()
-                                + "' does not exist" );
+                    + "' does not exist" );
             }
             else if ( !archiveBaseDir.isDirectory() )
             {
                 throw new ArchiveCreationException( "The archive base directory '" + archiveBaseDir.getAbsolutePath()
-                                + "' exists, but it is not a directory" );
+                    + "' exists, but it is not a directory" );
             }
         }
 
-        for (final FileSet fileSet : fileSets) {
-            addFileSet(fileSet, archiver, configSource, archiveBaseDir);
+        for ( final FileSet fileSet : fileSets )
+        {
+            addFileSet( fileSet, archiver, configSource, archiveBaseDir );
         }
     }
 
-    protected void addFileSet( final FileSet fileSet, final Archiver archiver,
-                               final AssemblerConfigurationSource configSource, final File archiveBaseDir )
+    void addFileSet( final FileSet fileSet, final Archiver archiver, final AssemblerConfigurationSource configSource,
+                     final File archiveBaseDir )
         throws AssemblyFormattingException, ArchiveCreationException
     {
         // throw this check in just in case someone extends this class...
         checkLogger();
 
-        final FileSetFormatter fileSetFormatter = new FileSetFormatter( configSource, logger );
-
         if ( project == null )
         {
             project = configSource.getProject();
@@ -121,9 +119,9 @@ public class AddFileSetsTask
         if ( logger.isDebugEnabled() )
         {
             logger.debug( "FileSet[" + destDirectory + "]" + " dir perms: "
-                            + Integer.toString( archiver.getOverrideDirectoryMode(), 8 ) + " file perms: "
-                            + Integer.toString( archiver.getOverrideFileMode(), 8 )
-                            + ( fileSet.getLineEnding() == null ? "" : " lineEndings: " + fileSet.getLineEnding() ) );
+                + Integer.toString( archiver.getOverrideDirectoryMode(), 8 ) + " file perms: "
+                + Integer.toString( archiver.getOverrideFileMode(), 8 )
+                + ( fileSet.getLineEnding() == null ? "" : " lineEndings: " + fileSet.getLineEnding() ) );
         }
 
         logger.debug( "The archive base directory is '" + archiveBaseDir + "'" );
@@ -132,25 +130,20 @@ public class AddFileSetsTask
 
         if ( fileSetDir.exists() )
         {
-            try
-            {
-                fileSetDir = fileSetFormatter.formatFileSetForAssembly( fileSetDir, fileSet );
-            }
-            catch ( final IOException e )
+            InputStreamTransformer fileSetTransformers = ReaderFormatter.getFileSetTransformers( configSource, fileSet.isFiltered(),
+                                                                                                 fileSet.getLineEnding() );
+            if (fileSetTransformers == null)
             {
-                throw new ArchiveCreationException( "Error fixing file-set line endings for assembly: "
-                                + e.getMessage(), e );
+                logger.debug( "NOT reformatting any files in " + fileSetDir );
             }
 
-            logger.debug( "Adding file-set from directory: '" + fileSetDir.getAbsolutePath()
-                            + "'\nassembly output directory is: \'" + destDirectory + "\'" );
-
-            if (fileSetDir.getPath().equals( File.separator ))
+            if ( fileSetDir.getPath().equals( File.separator ) )
             {
-                throw new AssemblyFormattingException( "Your assembly descriptor specifies a directory of " + File.separator +
-                   ", which is your *entire* file system.\nThese are not the files you are looking for");
+                throw new AssemblyFormattingException( "Your assembly descriptor specifies a directory of "
+                    + File.separator
+                    + ", which is your *entire* file system.\nThese are not the files you are looking for" );
             }
-            final AddDirectoryTask task = new AddDirectoryTask( fileSetDir );
+            final AddDirectoryTask task = new AddDirectoryTask( fileSetDir, fileSetTransformers );
 
             final int dirMode = TypeConversionUtils.modeToInt( fileSet.getDirectoryMode(), logger );
             if ( dirMode != -1 )
@@ -174,17 +167,16 @@ public class AddFileSetsTask
             task.setIncludes( fileSet.getIncludes() );
             task.setOutputDirectory( destDirectory );
 
-            task.execute( archiver, configSource );
+            task.execute( archiver );
         }
     }
 
-    protected File getFileSetDirectory( final FileSet fileSet, final File basedir, final File archiveBaseDir )
+    File getFileSetDirectory( final FileSet fileSet, final File basedir, final File archiveBaseDir )
         throws ArchiveCreationException, AssemblyFormattingException
     {
         String sourceDirectory = fileSet.getDirectory();
 
-        if ( sourceDirectory == null || sourceDirectory.trim()
-                                                       .length() < 1 )
+        if ( sourceDirectory == null || sourceDirectory.trim().length() < 1 )
         {
             sourceDirectory = basedir.getAbsolutePath();
         }
@@ -226,11 +218,6 @@ public class AddFileSetsTask
         this.project = project;
     }
 
-    public MavenProject getModuleProject()
-    {
-        return moduleProject;
-    }
-
     public void setModuleProject( final MavenProject moduleProject )
     {
         this.moduleProject = moduleProject;

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/DefaultDependencyResolver.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/DefaultDependencyResolver.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/DefaultDependencyResolver.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/DefaultDependencyResolver.java Thu Oct 23 21:01:23 2014
@@ -30,7 +30,6 @@ import org.apache.maven.artifact.Artifac
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactCollector;
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
@@ -38,7 +37,6 @@ import org.apache.maven.artifact.resolve
 import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
-import org.apache.maven.plugin.assembly.AssemblyContext;
 import org.apache.maven.plugin.assembly.archive.ArchiveCreationException;
 import org.apache.maven.plugin.assembly.archive.phase.ModuleSetAssemblyPhase;
 import org.apache.maven.plugin.assembly.model.Assembly;
@@ -46,6 +44,8 @@ import org.apache.maven.plugin.assembly.
 import org.apache.maven.plugin.assembly.model.ModuleBinaries;
 import org.apache.maven.plugin.assembly.model.ModuleSet;
 import org.apache.maven.plugin.assembly.model.Repository;
+import org.apache.maven.plugin.assembly.resolved.AssemblyId;
+import org.apache.maven.plugin.assembly.resolved.ResolvedModuleSet;
 import org.apache.maven.plugin.assembly.utils.FilterUtils;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.artifact.InvalidDependencyVersionException;
@@ -74,41 +74,69 @@ public class DefaultDependencyResolver
     @Requirement
     private ArtifactFactory factory;
 
-    @Requirement
-    private ArtifactCollector collector;
-
     public DefaultDependencyResolver()
     {
         // for plexus init
     }
 
     protected DefaultDependencyResolver( final ArtifactResolver resolver, final ArtifactMetadataSource metadataSource,
-                                         final ArtifactFactory factory, final ArtifactCollector collector,
-                                         final Logger logger )
+                                         final ArtifactFactory factory, final Logger logger )
     {
         this.resolver = resolver;
         this.metadataSource = metadataSource;
         this.factory = factory;
-        this.collector = collector;
-
         enableLogging( logger );
     }
 
-    public void resolve( final Assembly assembly, final AssemblerConfigurationSource configSource,
-                         final AssemblyContext context )
+    public Set<Artifact> resolve( final Assembly assembly, final AssemblerConfigurationSource configSource )
+        throws DependencyResolutionException
+    {
+        final MavenProject currentProject = configSource.getProject();
+
+        final ResolutionManagementInfo info = new ResolutionManagementInfo( currentProject );
+        updateRepositoryResolutionRequirements( assembly, info );
+        updateDependencySetResolutionRequirements( assembly.getDependencySets(), info,
+                                                   AssemblyId.createAssemblyId( assembly ), currentProject );
+
+        if ( !info.isResolutionRequired() )
+        {
+            return new HashSet<Artifact>();
+        }
+
+        final List<ArtifactRepository> repos =
+            aggregateRemoteArtifactRepositories( configSource.getRemoteRepositories(), info.getEnabledProjects() );
+
+        Set<Artifact> artifacts = info.getArtifacts();
+        if ( info.isResolvedTransitively() )
+        {
+            getLogger().debug( "Resolving project dependencies transitively." );
+            artifacts = resolveTransitively( artifacts, repos, info, configSource );
+        }
+        else
+        {
+            getLogger().debug( "Resolving project dependencies ONLY. Transitive dependencies WILL NOT be included in the results." );
+            artifacts = resolveNonTransitively( assembly, artifacts, configSource, repos );
+        }
+
+        return artifacts;
+    }
+
+    public ResolvedModuleSet resolve( final Assembly assembly, ModuleSet moduleSet,
+                                      final AssemblerConfigurationSource configSource )
         throws DependencyResolutionException
     {
         final MavenProject currentProject = configSource.getProject();
 
         final ResolutionManagementInfo info = new ResolutionManagementInfo( currentProject );
-        getRepositoryResolutionRequirements( assembly, info, currentProject );
-        getDependencySetResolutionRequirements( assembly, assembly.getDependencySets(), info, currentProject );
-        getModuleSetResolutionRequirements( assembly, info, configSource );
+        updateRepositoryResolutionRequirements( assembly, info );
+        final AssemblyId assemblyId = AssemblyId.createAssemblyId( assembly );
+        updateDependencySetResolutionRequirements( assembly.getDependencySets(), info, assemblyId, currentProject );
+        updateModuleSetResolutionRequirements( assemblyId, moduleSet, info, configSource );
 
+        ResolvedModuleSet base = ResolvedModuleSet.createResolvedModuleSet( moduleSet );
         if ( !info.isResolutionRequired() )
         {
-            context.setResolvedArtifacts( new HashSet<Artifact>() );
-            return;
+            return base.withArtifacts( new HashSet<Artifact>() );
         }
 
         final List<ArtifactRepository> repos =
@@ -126,33 +154,41 @@ public class DefaultDependencyResolver
             artifacts = resolveNonTransitively( assembly, artifacts, configSource, repos );
         }
 
-        context.setResolvedArtifacts( artifacts );
+        return base.withArtifacts( artifacts );
     }
 
-    protected Set<Artifact> resolveNonTransitively( final Assembly assembly, final Set<Artifact> dependencyArtifacts,
-                                                    final AssemblerConfigurationSource configSource,
-                                                    final List<ArtifactRepository> repos )
+    Set<Artifact> resolveNonTransitively( final Assembly assembly, final Set<Artifact> dependencyArtifacts,
+                                          final AssemblerConfigurationSource configSource,
+                                          final List<ArtifactRepository> repos )
         throws DependencyResolutionException
     {
 
         final List<Artifact> missing = new ArrayList<Artifact>();
         final Set<Artifact> resolved = new LinkedHashSet<Artifact>();
-        for (final Artifact depArtifact : dependencyArtifacts) {
-            try {
-                resolver.resolve(depArtifact, repos, configSource.getLocalRepository());
-                resolved.add(depArtifact);
-            } catch (final ArtifactResolutionException e) {
-                if (getLogger().isDebugEnabled()) {
-                    getLogger().debug("Failed to resolve: " + depArtifact.getId() + " for assembly: "
-                            + assembly.getId());
+        for ( final Artifact depArtifact : dependencyArtifacts )
+        {
+            try
+            {
+                resolver.resolve( depArtifact, repos, configSource.getLocalRepository() );
+                resolved.add( depArtifact );
+            }
+            catch ( final ArtifactResolutionException e )
+            {
+                if ( getLogger().isDebugEnabled() )
+                {
+                    getLogger().debug( "Failed to resolve: " + depArtifact.getId() + " for assembly: "
+                                           + assembly.getId() );
                 }
-                missing.add(depArtifact);
-            } catch (final ArtifactNotFoundException e) {
-                if (getLogger().isDebugEnabled()) {
-                    getLogger().debug("Failed to resolve: " + depArtifact.getId() + " for assembly: "
-                            + assembly.getId());
+                missing.add( depArtifact );
+            }
+            catch ( final ArtifactNotFoundException e )
+            {
+                if ( getLogger().isDebugEnabled() )
+                {
+                    getLogger().debug( "Failed to resolve: " + depArtifact.getId() + " for assembly: "
+                                           + assembly.getId() );
                 }
-                missing.add(depArtifact);
+                missing.add( depArtifact );
             }
         }
 
@@ -207,9 +243,7 @@ public class DefaultDependencyResolver
         return result.getArtifacts();
     }
 
-    protected void getRepositoryResolutionRequirements( final Assembly assembly,
-                                                        final ResolutionManagementInfo requirements,
-                                                        final MavenProject... project )
+    void updateRepositoryResolutionRequirements( final Assembly assembly, final ResolutionManagementInfo requirements )
     {
         final List<Repository> repositories = assembly.getRepositories();
 
@@ -223,9 +257,8 @@ public class DefaultDependencyResolver
         }
     }
 
-    protected void getModuleSetResolutionRequirements( final Assembly assembly,
-                                                       final ResolutionManagementInfo requirements,
-                                                       final AssemblerConfigurationSource configSource )
+    void updateModuleSetResolutionRequirements( final Assembly assembly, final ResolutionManagementInfo requirements,
+                                                final AssemblerConfigurationSource configSource )
         throws DependencyResolutionException
     {
         final List<ModuleSet> moduleSets = assembly.getModuleSets();
@@ -234,54 +267,62 @@ public class DefaultDependencyResolver
         {
             for ( final ModuleSet set : moduleSets )
             {
-                final ModuleBinaries binaries = set.getBinaries();
-                if ( binaries != null )
-                {
-                    Set<MavenProject> projects;
-                    try
-                    {
-                        projects = ModuleSetAssemblyPhase.getModuleProjects( set, configSource, getLogger() );
-                    }
-                    catch ( final ArchiveCreationException e )
-                    {
-                        throw new DependencyResolutionException(
-                                                                 "Error determining project-set for moduleSet with binaries.",
-                                                                 e );
-                    }
+                updateModuleSetResolutionRequirements( AssemblyId.createAssemblyId( assembly.getId() ), set,
+                                                       requirements, configSource );
+            }
+        }
+    }
 
-                    if ( projects != null && !projects.isEmpty() )
-                    {
-                        for ( final MavenProject p : projects )
-                        {
-                            requirements.enableProjectResolution( p );
-
-                            if ( p.getArtifact() == null )
-                            {
-                                // TODO: such a call in MavenMetadataSource too - packaging not really the intention of
-                                // type
-                                final Artifact artifact =
-                                    factory.createBuildArtifact( p.getGroupId(), p.getArtifactId(), p.getVersion(),
-                                                                 p.getPackaging() );
-                                p.setArtifact( artifact );
-                            }
-                        }
-                    }
+    void updateModuleSetResolutionRequirements( AssemblyId assemblyId, ModuleSet set,
+                                                final ResolutionManagementInfo requirements,
+                                                final AssemblerConfigurationSource configSource )
+        throws DependencyResolutionException
+    {
+        final ModuleBinaries binaries = set.getBinaries();
+        if ( binaries != null )
+        {
+            Set<MavenProject> projects;
+            try
+            {
+                projects = ModuleSetAssemblyPhase.getModuleProjects( set, configSource, getLogger() );
+            }
+            catch ( final ArchiveCreationException e )
+            {
+                throw new DependencyResolutionException( "Error determining project-set for moduleSet with binaries.",
+                                                         e );
+            }
 
-                    if ( binaries.isIncludeDependencies() )
+            if ( !projects.isEmpty() )
+            {
+                for ( final MavenProject p : projects )
+                {
+                    requirements.enableProjectResolution( p );
+
+                    if ( p.getArtifact() == null )
                     {
-                        getDependencySetResolutionRequirements( assembly,
-                                                                ModuleSetAssemblyPhase.getDependencySets( binaries ),
-                                                                requirements, projects.toArray(new MavenProject[projects.size()]));
+                        // TODO: such a call in MavenMetadataSource too - packaging not really the intention of
+                        // type
+                        final Artifact artifact =
+                            factory.createBuildArtifact( p.getGroupId(), p.getArtifactId(), p.getVersion(),
+                                                         p.getPackaging() );
+                        p.setArtifact( artifact );
                     }
                 }
             }
+
+            if ( binaries.isIncludeDependencies() )
+            {
+                updateDependencySetResolutionRequirements( ModuleSetAssemblyPhase.getDependencySets( binaries ),
+                                                           requirements, assemblyId,
+                                                           projects.toArray( new MavenProject[projects.size()] ) );
+            }
         }
     }
 
     @SuppressWarnings( "unchecked" )
-    protected void getDependencySetResolutionRequirements( final Assembly assembly, final List<DependencySet> depSets,
-                                                           final ResolutionManagementInfo requirements,
-                                                           final MavenProject... projects )
+    void updateDependencySetResolutionRequirements( final List<DependencySet> depSets,
+                                                    final ResolutionManagementInfo requirements, AssemblyId assemblyId,
+                                                    final MavenProject... projects )
         throws DependencyResolutionException
     {
         if ( depSets != null && !depSets.isEmpty() )
@@ -290,6 +331,7 @@ public class DefaultDependencyResolver
 
             for ( final DependencySet set : depSets )
             {
+                // Surely this must be a bug, if there's multiple depSets with different isUseTransitiveDependencies
                 requirements.setResolvedTransitively( set.isUseTransitiveDependencies() );
 
                 enableScope( set.getScope(), requirements );
@@ -314,7 +356,7 @@ public class DefaultDependencyResolver
                     {
                         throw new DependencyResolutionException(
                                                                  "Failed to create dependency artifacts for resolution. Assembly: "
-                                                                     + assembly.getId(), e );
+                                                                     + assemblyId, e );
                     }
                 }
 
@@ -350,8 +392,8 @@ public class DefaultDependencyResolver
     }
 
     @SuppressWarnings( "unchecked" )
-    protected List<ArtifactRepository> aggregateRemoteArtifactRepositories( final List<ArtifactRepository> remoteRepositories,
-                                                                            final Set<MavenProject> projects )
+    List<ArtifactRepository> aggregateRemoteArtifactRepositories( final List<ArtifactRepository> remoteRepositories,
+                                                                  final Set<MavenProject> projects )
     {
         final List<List<ArtifactRepository>> repoLists = new ArrayList<List<ArtifactRepository>>();
 
@@ -364,12 +406,16 @@ public class DefaultDependencyResolver
         final List<ArtifactRepository> remoteRepos = new ArrayList<ArtifactRepository>();
         final Set<String> encounteredUrls = new HashSet<String>();
 
-        for (final List<ArtifactRepository> repositoryList : repoLists) {
-            if ((repositoryList != null) && !repositoryList.isEmpty()) {
-                for (final ArtifactRepository repo : repositoryList) {
-                    if (!encounteredUrls.contains(repo.getUrl())) {
-                        remoteRepos.add(repo);
-                        encounteredUrls.add(repo.getUrl());
+        for ( final List<ArtifactRepository> repositoryList : repoLists )
+        {
+            if ( ( repositoryList != null ) && !repositoryList.isEmpty() )
+            {
+                for ( final ArtifactRepository repo : repositoryList )
+                {
+                    if ( !encounteredUrls.contains( repo.getUrl() ) )
+                    {
+                        remoteRepos.add( repo );
+                        encounteredUrls.add( repo.getUrl() );
                     }
                 }
             }
@@ -378,59 +424,4 @@ public class DefaultDependencyResolver
         return remoteRepos;
     }
 
-    protected ArtifactResolver getArtifactResolver()
-    {
-        return resolver;
-    }
-
-    protected DefaultDependencyResolver setArtifactResolver( final ArtifactResolver resolver )
-    {
-        this.resolver = resolver;
-
-        return this;
-    }
-
-    protected ArtifactMetadataSource getArtifactMetadataSource()
-    {
-        return metadataSource;
-    }
-
-    protected DefaultDependencyResolver setArtifactMetadataSource( final ArtifactMetadataSource metadataSource )
-    {
-        this.metadataSource = metadataSource;
-
-        return this;
-    }
-
-    protected ArtifactFactory getArtifactFactory()
-    {
-        return factory;
-    }
-
-    protected DefaultDependencyResolver setArtifactFactory( final ArtifactFactory factory )
-    {
-        this.factory = factory;
-
-        return this;
-    }
-
-    protected ArtifactCollector getArtifactCollector()
-    {
-        return collector;
-    }
-
-    protected DefaultDependencyResolver setArtifactCollector( final ArtifactCollector collector )
-    {
-        this.collector = collector;
-
-        return this;
-    }
-
-    protected DefaultDependencyResolver setLogger( final Logger logger )
-    {
-        enableLogging( logger );
-
-        return this;
-    }
-
 }

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/DependencyResolutionException.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/DependencyResolutionException.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/DependencyResolutionException.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/DependencyResolutionException.java Thu Oct 23 21:01:23 2014
@@ -33,9 +33,4 @@ public class DependencyResolutionExcepti
         super( message, error );
     }
 
-    public DependencyResolutionException( final String message )
-    {
-        super( message );
-    }
-
 }

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/DependencyResolver.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/DependencyResolver.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/DependencyResolver.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/DependencyResolver.java Thu Oct 23 21:01:23 2014
@@ -19,14 +19,18 @@ package org.apache.maven.plugin.assembly
  * under the License.
  */
 
+import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
-import org.apache.maven.plugin.assembly.AssemblyContext;
 import org.apache.maven.plugin.assembly.model.Assembly;
+import org.apache.maven.plugin.assembly.model.ModuleSet;
+import org.apache.maven.plugin.assembly.resolved.ResolvedModuleSet;
+
+import java.util.Set;
 
 /**
  * Convenience component that aids in the resolution of dependency artifacts, according to various configurations such
  * as transitivity flag and scope.
- * 
+ *
  * @version $Id$
  */
 public interface DependencyResolver
@@ -35,7 +39,10 @@ public interface DependencyResolver
     /**
      * Resolve the project dependencies, according to the supplied configuration.
      */
-    void resolve( Assembly assembly, AssemblerConfigurationSource configSource, AssemblyContext context )
+    Set<Artifact> resolve( Assembly assembly, AssemblerConfigurationSource configSource )
         throws DependencyResolutionException;
 
+    ResolvedModuleSet resolve( final Assembly assembly, ModuleSet moduleSet,
+                           final AssemblerConfigurationSource configSource )
+        throws DependencyResolutionException;
 }
\ No newline at end of file

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/ResolutionManagementInfo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/ResolutionManagementInfo.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/ResolutionManagementInfo.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/artifact/ResolutionManagementInfo.java Thu Oct 23 21:01:23 2014
@@ -129,8 +129,4 @@ class ResolutionManagementInfo
         artifacts.addAll( a );
     }
 
-    void addArtifact( final Artifact a )
-    {
-        artifacts.add( a );
-    }
 }

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/AbstractLineAggregatingHandler.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/AbstractLineAggregatingHandler.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/AbstractLineAggregatingHandler.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/AbstractLineAggregatingHandler.java Thu Oct 23 21:01:23 2014
@@ -39,7 +39,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-public abstract class AbstractLineAggregatingHandler
+abstract class AbstractLineAggregatingHandler
     implements ContainerDescriptorHandler
 {
 
@@ -51,7 +51,7 @@ public abstract class AbstractLineAggreg
 
     protected abstract boolean fileMatches( final FileInfo fileInfo );
 
-    protected String getEncoding()
+    String getEncoding()
     {
         return "UTF-8";
     }
@@ -72,7 +72,7 @@ public abstract class AbstractLineAggreg
         addToArchive( archiver );
     }
 
-    protected void addToArchive( final Archiver archiver )
+    void addToArchive( final Archiver archiver )
         throws ArchiverException
     {
         for ( final Map.Entry<String, List<String>> entry : catalog.entrySet() )
@@ -127,9 +127,7 @@ public abstract class AbstractLineAggreg
             return true;
         }
 
-        String name = fileInfo.getName();
-        name = AssemblyFileUtils.normalizePath( name );
-        name = name.replace( File.separatorChar, '/' );
+        String name = AssemblyFileUtils.normalizeFileInfo(fileInfo );
 
         if ( fileInfo.isFile() && fileMatches( fileInfo ) )
         {
@@ -150,7 +148,7 @@ public abstract class AbstractLineAggreg
         return true;
     }
 
-    protected void readLines( final FileInfo fileInfo, final List<String> lines )
+    void readLines( final FileInfo fileInfo, final List<String> lines )
         throws IOException
     {
         BufferedReader reader = null;

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java Thu Oct 23 21:01:23 2014
@@ -37,6 +37,7 @@ import org.codehaus.plexus.archiver.Arch
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.ResourceIterator;
 import org.codehaus.plexus.archiver.UnArchiver;
+import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.components.io.fileselectors.FileInfo;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
@@ -50,19 +51,21 @@ import org.codehaus.plexus.util.xml.pull
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  * @version $Id$
  */
+@Component( role = ContainerDescriptorHandler.class, hint = "plexus", instantiationStrategy = "per-lookup" )
 public class ComponentsXmlArchiverFileFilter
     implements ContainerDescriptorHandler
 {
     // [jdcasey] Switched visibility to protected to allow testing. Also, because this class isn't final, it should
     // allow
     // some minimal access to the components accumulated for extending classes.
-    protected Map<String, Xpp3Dom> components;
+    Map<String, Xpp3Dom> components;
 
     private boolean excludeOverride = false;
 
     public static final String COMPONENTS_XML_PATH = "META-INF/plexus/components.xml";
 
-    protected void addComponentsXml( final Reader componentsReader ) throws XmlPullParserException, IOException
+    void addComponentsXml( final Reader componentsReader )
+        throws XmlPullParserException, IOException
     {
         Xpp3Dom newDom = Xpp3DomBuilder.build( componentsReader );
 
@@ -75,22 +78,26 @@ public class ComponentsXmlArchiverFileFi
         {
             final Xpp3Dom[] children = newDom.getChildren();
 
-            for (final Xpp3Dom component : children) {
-                if (components == null) {
+            for ( final Xpp3Dom component : children )
+            {
+                if ( components == null )
+                {
                     components = new LinkedHashMap<String, Xpp3Dom>();
                 }
 
-                final String role = component.getChild("role")
-                        .getValue();
-                final Xpp3Dom child = component.getChild("role-hint");
+                final String role = component.getChild( "role" ).getValue();
+                final Xpp3Dom child = component.getChild( "role-hint" );
                 final String roleHint = child != null ? child.getValue() : "";
 
                 final String key = role + roleHint;
-                if (!components.containsKey(key)) {
-                    System.out.println("Adding " + key);
-                    components.put(key, component);
-                } else {
-                    System.out.println("Component: " + key + " is already defined. Skipping.");
+                if ( !components.containsKey( key ) )
+                {
+                    System.out.println( "Adding " + key );
+                    components.put( key, component );
+                }
+                else
+                {
+                    System.out.println( "Component: " + key + " is already defined. Skipping." );
                 }
             }
         }
@@ -112,7 +119,8 @@ public class ComponentsXmlArchiverFileFi
     // }
     // }
 
-    private void addToArchive( final Archiver archiver ) throws IOException, ArchiverException
+    private void addToArchive( final Archiver archiver )
+        throws IOException, ArchiverException
     {
         if ( components != null )
         {
@@ -127,8 +135,9 @@ public class ComponentsXmlArchiverFileFi
                 final Xpp3Dom componentDom = new Xpp3Dom( "components" );
                 dom.addChild( componentDom );
 
-                for (final Xpp3Dom component : components.values()) {
-                    componentDom.addChild(component);
+                for ( final Xpp3Dom component : components.values() )
+                {
+                    componentDom.addChild( component );
                 }
 
                 Xpp3DomWriter.write( fileWriter, dom );
@@ -146,7 +155,8 @@ public class ComponentsXmlArchiverFileFi
         }
     }
 
-    public void finalizeArchiveCreation( final Archiver archiver ) throws ArchiverException
+    public void finalizeArchiveCreation( final Archiver archiver )
+        throws ArchiverException
     {
         // this will prompt the isSelected() call, below, for all resources added to the archive.
         // FIXME: This needs to be corrected in the AbstractArchiver, where
@@ -178,7 +188,8 @@ public class ComponentsXmlArchiverFileFi
         return null;
     }
 
-    public boolean isSelected( final FileInfo fileInfo ) throws IOException
+    public boolean isSelected( final FileInfo fileInfo )
+        throws IOException
     {
         if ( fileInfo.isFile() )
         {
@@ -187,8 +198,7 @@ public class ComponentsXmlArchiverFileFi
                 return true;
             }
 
-            String entry = fileInfo.getName()
-                                   .replace( '\\', '/' );
+            String entry = fileInfo.getName().replace( '\\', '/' );
 
             if ( entry.startsWith( "/" ) )
             {
@@ -205,7 +215,7 @@ public class ComponentsXmlArchiverFileFi
                     stream = fileInfo.getContents();
                     // TODO use ReaderFactory.newXmlReader() when plexus-utils is upgraded to 1.4.5+
                     reader = new InputStreamReader( stream, "UTF-8" );
-                    addComponentsXml( new BufferedReader( reader, 8192 ));
+                    addComponentsXml( new BufferedReader( reader, 8192 ) );
                 }
                 catch ( final XmlPullParserException e )
                 {
@@ -234,7 +244,8 @@ public class ComponentsXmlArchiverFileFi
         }
     }
 
-    public void finalizeArchiveExtraction( final UnArchiver unarchiver ) throws ArchiverException
+    public void finalizeArchiveExtraction( final UnArchiver unarchiver )
+        throws ArchiverException
     {
     }
 

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/MetaInfServicesHandler.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/MetaInfServicesHandler.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/MetaInfServicesHandler.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/MetaInfServicesHandler.java Thu Oct 23 21:01:23 2014
@@ -22,7 +22,7 @@ package org.apache.maven.plugin.assembly
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.components.io.fileselectors.FileInfo;
 
-@Component( role = ContainerDescriptorHandler.class, hint = "metaInf-services" )
+@Component( role = ContainerDescriptorHandler.class, hint = "metaInf-services", instantiationStrategy = "per-lookup" )
 public class MetaInfServicesHandler
     extends AbstractLineAggregatingHandler
 {

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/MetaInfSpringHandler.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/MetaInfSpringHandler.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/MetaInfSpringHandler.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/MetaInfSpringHandler.java Thu Oct 23 21:01:23 2014
@@ -22,7 +22,7 @@ package org.apache.maven.plugin.assembly
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.components.io.fileselectors.FileInfo;
 
-@Component( role = ContainerDescriptorHandler.class, hint = "metaInf-spring" )
+@Component( role = ContainerDescriptorHandler.class, hint = "metaInf-spring", instantiationStrategy = "per-lookup" )
 public class MetaInfSpringHandler
     extends AbstractLineAggregatingHandler
 {

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/SimpleAggregatingDescriptorHandler.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/SimpleAggregatingDescriptorHandler.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/SimpleAggregatingDescriptorHandler.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/filter/SimpleAggregatingDescriptorHandler.java Thu Oct 23 21:01:23 2014
@@ -19,10 +19,23 @@ package org.apache.maven.plugin.assembly
  * under the License.
  */
 
+import org.apache.maven.plugin.assembly.utils.AssemblyFileUtils;
+import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.UnArchiver;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.components.io.fileselectors.FileInfo;
+import org.codehaus.plexus.logging.LogEnabled;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.logging.console.ConsoleLogger;
+import org.codehaus.plexus.util.IOUtil;
+
+import javax.annotation.Nonnull;
 import java.io.File;
-import java.io.FileWriter;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
 import java.io.Reader;
 import java.io.StringWriter;
 import java.io.Writer;
@@ -31,19 +44,10 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 
-import org.apache.maven.plugin.assembly.utils.AssemblyFileUtils;
-import org.codehaus.plexus.archiver.Archiver;
-import org.codehaus.plexus.archiver.ArchiverException;
-import org.codehaus.plexus.archiver.UnArchiver;
-import org.codehaus.plexus.components.io.fileselectors.FileInfo;
-import org.codehaus.plexus.logging.LogEnabled;
-import org.codehaus.plexus.logging.Logger;
-import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.codehaus.plexus.util.IOUtil;
-
 /**
  * @version $Id$
  */
+@Component( role = ContainerDescriptorHandler.class, hint = "file-aggregator", instantiationStrategy = "per-lookup" )
 public class SimpleAggregatingDescriptorHandler
     implements ContainerDescriptorHandler, LogEnabled
 {
@@ -54,6 +58,7 @@ public class SimpleAggregatingDescriptor
 
     private String outputPath;
 
+    @SuppressWarnings( "FieldCanBeLocal" )
     private final String commentChars = "#";
 
     // calculated, temporary values.
@@ -68,7 +73,8 @@ public class SimpleAggregatingDescriptor
 
     private Logger logger;
 
-    public void finalizeArchiveCreation( final Archiver archiver ) throws ArchiverException
+    public void finalizeArchiveCreation( final Archiver archiver )
+        throws ArchiverException
     {
         checkConfig();
 
@@ -76,7 +82,7 @@ public class SimpleAggregatingDescriptor
         {
             throw new ArchiverException(
                                          "Cannot write aggregated properties to a directory. You must specify a file name in the outputPath configuration for this handler. (handler: "
-                                                         + getClass().getName() );
+                                             + getClass().getName() );
         }
 
         if ( outputPath.startsWith( "/" ) )
@@ -93,7 +99,8 @@ public class SimpleAggregatingDescriptor
         overrideFilterAction = false;
     }
 
-    private File writePropertiesFile() throws ArchiverException
+    private File writePropertiesFile()
+        throws ArchiverException
     {
         File f;
 
@@ -103,13 +110,17 @@ public class SimpleAggregatingDescriptor
             f = File.createTempFile( "maven-assembly-plugin", "tmp" );
             f.deleteOnExit();
 
-            // FIXME if it is a properties file, encoding should be ISO-8859-1
-            writer = new FileWriter( f ); // platform encoding
+
+            boolean isProperty = AssemblyFileUtils.isPropertyFile(f);
+            FileOutputStream fos = new FileOutputStream( f );
+            writer = isProperty ? new OutputStreamWriter( fos,  "ISO-8859-1")
+                : new OutputStreamWriter( fos); // Still platform encoding
 
             writer.write( commentChars + " Aggregated on " + new Date() + " from: " );
 
-            for (final String filename : filenames) {
-                writer.write("\n" + commentChars + " " + filename);
+            for ( final String filename : filenames )
+            {
+                writer.write( "\n" + commentChars + " " + filename );
             }
 
             writer.write( "\n\n" );
@@ -119,7 +130,7 @@ public class SimpleAggregatingDescriptor
         catch ( final IOException e )
         {
             throw new ArchiverException( "Error adding aggregated properties to finalize archive creation. Reason: "
-                            + e.getMessage(), e );
+                + e.getMessage(), e );
         }
         finally
         {
@@ -129,7 +140,8 @@ public class SimpleAggregatingDescriptor
         return f;
     }
 
-    public void finalizeArchiveExtraction( final UnArchiver unarchiver ) throws ArchiverException
+    public void finalizeArchiveExtraction( final UnArchiver unarchiver )
+        throws ArchiverException
     {
     }
 
@@ -140,7 +152,8 @@ public class SimpleAggregatingDescriptor
         return Collections.singletonList( outputPath );
     }
 
-    public boolean isSelected( final FileInfo fileInfo ) throws IOException
+    public boolean isSelected( final @Nonnull FileInfo fileInfo )
+        throws IOException
     {
         checkConfig();
 
@@ -150,10 +163,7 @@ public class SimpleAggregatingDescriptor
             return true;
         }
 
-        String name = fileInfo.getName();
-        name = AssemblyFileUtils.normalizePath( name );
-
-        name = name.replace( File.separatorChar, '/' );
+        String name = AssemblyFileUtils.normalizeFileInfo( fileInfo );
 
         if ( fileInfo.isFile() && name.matches( filePattern ) )
         {
@@ -175,14 +185,17 @@ public class SimpleAggregatingDescriptor
         }
     }
 
-    private void readProperties( final FileInfo fileInfo ) throws IOException
+    private void readProperties( final FileInfo fileInfo )
+        throws IOException
     {
         final StringWriter writer = new StringWriter();
         Reader reader = null;
         try
         {
-            // FIXME if it is a properties file, encoding should be ISO-8859-1
-            reader = new InputStreamReader( fileInfo.getContents() ); // platform encoding
+            boolean isProperty = AssemblyFileUtils.isPropertyFile(fileInfo.getName());
+
+            reader = isProperty ? new InputStreamReader( fileInfo.getContents(), "ISO-8859-1" ) :
+            new InputStreamReader( fileInfo.getContents() ); // platform encoding
 
             IOUtil.copy( reader, writer );
         }
@@ -212,21 +225,25 @@ public class SimpleAggregatingDescriptor
         this.logger = logger;
     }
 
+    @SuppressWarnings( "UnusedDeclaration" )
     public String getFilePattern()
     {
         return filePattern;
     }
 
+    @SuppressWarnings( "UnusedDeclaration" )
     public void setFilePattern( final String filePattern )
     {
         this.filePattern = filePattern;
     }
 
+    @SuppressWarnings( "UnusedDeclaration" )
     public String getOutputPath()
     {
         return outputPath;
     }
 
+    @SuppressWarnings( "UnusedDeclaration" )
     public void setOutputPath( final String outputPath )
     {
         this.outputPath = outputPath;

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java Thu Oct 23 21:01:23 2014
@@ -19,25 +19,27 @@ package org.apache.maven.plugin.assembly
  * under the License.
  */
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Locale;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugin.assembly.utils.AssemblyFileUtils;
+import org.apache.maven.plugin.assembly.utils.LineEndings;
+import org.apache.maven.plugin.assembly.utils.LineEndingsUtils;
 import org.apache.maven.shared.filtering.MavenFileFilterRequest;
 import org.apache.maven.shared.filtering.MavenFilteringException;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.StringUtils;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Locale;
-
 /**
  * @version $Id$
  */
@@ -54,16 +56,10 @@ public class FileFormatter
         this.logger = logger;
     }
 
-    public File format( File source, boolean filter, String lineEnding, String encoding )
-        throws AssemblyFormattingException
-    {
-        return format( source, filter, lineEnding, configSource.getTemporaryRootDirectory(), encoding );
-    }
-
-    public File format( @Nonnull File source, boolean filter, String lineEnding, @Nullable File tempRoot,
-                        String encoding )
+    public File format( @Nonnull File source, boolean filter, String lineEnding, String encoding )
         throws AssemblyFormattingException
     {
+        File tempRoot = configSource.getTemporaryRootDirectory();
         AssemblyFileUtils.verifyTempDirectoryAvailability( tempRoot );
 
         File result = source;
@@ -71,38 +67,65 @@ public class FileFormatter
         if ( StringUtils.isEmpty( encoding ) && filter )
         {
             logger.warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
-                             + ", i.e. build is platform dependent!" );
+                + ", i.e. build is platform dependent!" );
         }
 
         if ( filter )
         {
-            result = doFileFilter( source, tempRoot, encoding, configSource.getEscapeString() );
+            result =
+                doFileFilter( source, tempRoot, encoding, configSource.getEscapeString(), configSource.getDelimiters() );
         }
 
-        String lineEndingChars = AssemblyFileUtils.getLineEndingCharacters( lineEnding );
-        if ( lineEndingChars != null )
+        LineEndings lineEnding1 = LineEndingsUtils.getLineEnding( lineEnding );
+        if ( !LineEndings.keep.equals( lineEnding1 ) )
         {
-            result = formatLineEndings( lineEndingChars, result, tempRoot, encoding );
+            result = formatLineEndings( lineEnding1, result, tempRoot, encoding );
         }
 
         return result;
     }
 
-    private File doFileFilter( @Nonnull File source, @Nullable File tempRoot, String encoding, String escapeString )
+    private File doFileFilter( @Nonnull File source, @Nullable File tempRoot, String encoding, String escapeString,
+                               List<String> delimiters )
         throws AssemblyFormattingException
     {
         try
         {
             File target = FileUtils.createTempFile( source.getName() + ".", ".filtered", tempRoot );
 
-            //@todo this test can be improved
+            // @todo this test can be improved
             boolean isPropertiesFile = source.getName().toLowerCase( Locale.ENGLISH ).endsWith( ".properties" );
 
             MavenFileFilterRequest filterRequest =
                 new MavenFileFilterRequest( source, target, true, configSource.getProject(), configSource.getFilters(),
                                             isPropertiesFile, encoding, configSource.getMavenSession(), null );
             filterRequest.setEscapeString( escapeString );
-            filterRequest.setInjectProjectBuildFilters( true );
+
+            // if these are NOT set, just use the defaults, which are '${*}' and '@'.
+            if ( delimiters != null && !delimiters.isEmpty() )
+            {
+                LinkedHashSet<String> delims = new LinkedHashSet<String>();
+                for ( String delim : delimiters )
+                {
+                    if ( delim == null )
+                    {
+                        // FIXME: ${filter:*} could also trigger this condition. Need a better long-term solution.
+                        delims.add( "${*}" );
+                    }
+                    else
+                    {
+                        delims.add( delim );
+                    }
+                }
+
+                filterRequest.setDelimiters( delims );
+            }
+            else
+            {
+                filterRequest.setDelimiters( filterRequest.getDelimiters() );
+            }
+
+            filterRequest.setInjectProjectBuildFilters( configSource.isIncludeProjectBuildFilters() );
             configSource.getMavenFileFilter().copyFile( filterRequest );
 
             return target;
@@ -113,15 +136,15 @@ public class FileFormatter
         }
     }
 
-    private File formatLineEndings( String lineEndingChars, File source, File tempRoot, String encoding )
+
+    private File formatLineEndings( LineEndings lineEnding, File source, File tempRoot, String encoding )
         throws AssemblyFormattingException
     {
-        Reader contentReader = null;
         try
         {
             File target = FileUtils.createTempFile( source.getName() + ".", ".formatted", tempRoot );
 
-            AssemblyFileUtils.convertLineEndings( source, target, lineEndingChars, null, encoding );
+            LineEndingsUtils.convertLineEndings( source, target, lineEnding, null, encoding );
 
             return target;
         }
@@ -131,12 +154,7 @@ public class FileFormatter
         }
         catch ( IOException e )
         {
-            throw new AssemblyFormattingException( "Error line formatting file '" + source + "': " + e.getMessage(),
-                                                   e );
-        }
-        finally
-        {
-            IOUtil.close( contentReader );
+            throw new AssemblyFormattingException( "Error line formatting file '" + source + "': " + e.getMessage(), e );
         }
     }
 }

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/format/ReflectionProperties.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/format/ReflectionProperties.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/format/ReflectionProperties.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/format/ReflectionProperties.java Thu Oct 23 21:01:23 2014
@@ -29,7 +29,7 @@ import java.util.Properties;
  * @author Andreas Hoheneder (ahoh_at_inode.at)
  * @version $Id$
  * 
- * @depcrecated
+ * @deprecated
  */
 @Deprecated
 public class ReflectionProperties
@@ -40,7 +40,7 @@ public class ReflectionProperties
 
     private final MavenProject project;
 
-    boolean escapedBackslashesInFilePath;
+    final boolean escapedBackslashesInFilePath;
 
     public ReflectionProperties( final MavenProject aProject, final boolean escapedBackslashesInFilePath )
     {

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyExpressionEvaluator.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyExpressionEvaluator.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyExpressionEvaluator.java Thu Oct 23 21:01:23 2014
@@ -34,8 +34,8 @@ public class AssemblyExpressionEvaluator
 {
     
     private final AssemblerConfigurationSource configSource;
-    private Interpolator interpolator;
-    private PrefixAwareRecursionInterceptor interceptor;
+    private final Interpolator interpolator;
+    private final PrefixAwareRecursionInterceptor interceptor;
 
     public AssemblyExpressionEvaluator( AssemblerConfigurationSource configSource )
     {

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolationException.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolationException.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolationException.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolationException.java Thu Oct 23 21:01:23 2014
@@ -27,43 +27,9 @@ public class AssemblyInterpolationExcept
 {
     private static final long serialVersionUID = 1L;
 
-    private String expression;
-
-    private String originalMessage;
-
-    public AssemblyInterpolationException( final String message )
-    {
-        super( message );
-    }
-
     public AssemblyInterpolationException( final String message, final Throwable cause )
     {
         super( message, cause );
     }
 
-    public AssemblyInterpolationException( final String expression, final String message, final Throwable cause )
-    {
-        super( "The Assembly expression: " + expression + " could not be evaluated. Reason: " + message, cause );
-
-        this.expression = expression;
-        originalMessage = message;
-    }
-
-    public AssemblyInterpolationException( final String expression, final String message )
-    {
-        super( "The Assembly expression: " + expression + " could not be evaluated. Reason: " + message );
-
-        this.expression = expression;
-        originalMessage = message;
-    }
-
-    public String getExpression()
-    {
-        return expression;
-    }
-
-    public String getOriginalMessage()
-    {
-        return originalMessage;
-    }
 }

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolator.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolator.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolator.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolator.java Thu Oct 23 21:01:23 2014
@@ -29,6 +29,7 @@ import java.util.Set;
 
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
+import org.apache.maven.plugin.assembly.io.DefaultAssemblyReader;
 import org.apache.maven.plugin.assembly.model.Assembly;
 import org.apache.maven.plugin.assembly.utils.AssemblyFileUtils;
 import org.apache.maven.plugin.assembly.utils.InterpolationConstants;
@@ -115,7 +116,7 @@ public class AssemblyInterpolator
         catch ( final InterpolationException e )
         {
             throw new AssemblyInterpolationException( "Failed to interpolate assembly with ID: " + assembly.getId()
-                            + ". Reason: " + e.getMessage(), e );
+                + ". Reason: " + e.getMessage(), e );
         }
         finally
         {
@@ -126,12 +127,13 @@ public class AssemblyInterpolator
         {
             final StringBuilder sb = new StringBuilder();
 
-            sb.append("One or more minor errors occurred while interpolating the assembly with ID: ").append(assembly.getId()).append(":\n");
+            sb.append( "One or more minor errors occurred while interpolating the assembly with ID: " ).append( assembly.getId() ).append( ":\n" );
 
             @SuppressWarnings( "unchecked" )
             final List<ObjectInterpolationWarning> warnings = objectInterpolator.getWarnings();
-            for (final ObjectInterpolationWarning warning : warnings) {
-                sb.append('\n').append(warning);
+            for ( final ObjectInterpolationWarning warning : warnings )
+            {
+                sb.append( '\n' ).append( warning );
             }
 
             sb.append( "\n\nThese values were SKIPPED, but the assembly process will continue.\n" );
@@ -189,20 +191,7 @@ public class AssemblyInterpolator
 
         interpolator.addValueSource( new PropertiesBasedValueSource( settingsProperties ) );
 
-        Properties commandLineProperties = System.getProperties();
-        if ( session != null )
-        {
-            commandLineProperties = new Properties();
-            if ( session.getExecutionProperties() != null )
-            {
-                commandLineProperties.putAll( session.getExecutionProperties() );
-            }
-            
-            if ( session.getUserProperties() != null )
-            {
-                commandLineProperties.putAll( session.getUserProperties() );
-            }
-        }
+        Properties commandLineProperties = DefaultAssemblyReader.mergeExecutionPropertiesWithSystemPropertiew( session );
 
         // 7
         interpolator.addValueSource( new PropertiesBasedValueSource( commandLineProperties ) );

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java Thu Oct 23 21:01:23 2014
@@ -111,17 +111,19 @@ public class DefaultAssemblyReader
         if ( ( descriptors != null ) && ( descriptors.length > 0 ) )
         {
             locator.setStrategies( strategies );
-            for (String descriptor1 : descriptors) {
-                getLogger().info("Reading assembly descriptor: " + descriptor1);
-                addAssemblyFromDescriptor(descriptor1, locator, configSource, assemblies);
+            for ( String descriptor1 : descriptors )
+            {
+                getLogger().info( "Reading assembly descriptor: " + descriptor1 );
+                addAssemblyFromDescriptor( descriptor1, locator, configSource, assemblies );
             }
         }
 
         if ( ( descriptorRefs != null ) && ( descriptorRefs.length > 0 ) )
         {
             locator.setStrategies( refStrategies );
-            for (String descriptorRef : descriptorRefs) {
-                addAssemblyForDescriptorReference(descriptorRef, configSource, assemblies);
+            for ( String descriptorRef : descriptorRefs )
+            {
+                addAssemblyForDescriptorReference( descriptorRef, configSource, assemblies );
             }
         }
 
@@ -163,8 +165,9 @@ public class DefaultAssemblyReader
 
             if ( paths != null )
             {
-                for (String path : paths) {
-                    addAssemblyFromDescriptor(path, locator, configSource, assemblies);
+                for ( String path : paths )
+                {
+                    addAssemblyFromDescriptor( path, locator, configSource, assemblies );
                 }
             }
         }
@@ -183,9 +186,11 @@ public class DefaultAssemblyReader
 
         // check unique IDs
         final Set<String> ids = new HashSet<String>();
-        for (final Assembly assembly : assemblies) {
-            if (!ids.add(assembly.getId())) {
-                getLogger().warn("The assembly id " + assembly.getId() + " is used more than once.");
+        for ( final Assembly assembly : assemblies )
+        {
+            if ( !ids.add( assembly.getId() ) )
+            {
+                getLogger().warn( "The assembly id " + assembly.getId() + " is used more than once." );
             }
 
         }
@@ -347,20 +352,7 @@ public class DefaultAssemblyReader
             final Map<String, String> context = new HashMap<String, String>();
             final MavenSession session = configSource.getMavenSession();
 
-            Properties commandLineProperties = System.getProperties();
-            if ( session != null )
-            {
-                commandLineProperties = new Properties();
-                if ( session.getExecutionProperties() != null )
-                {
-                    commandLineProperties.putAll( session.getExecutionProperties() );
-                }
-
-                if ( session.getUserProperties() != null )
-                {
-                    commandLineProperties.putAll( session.getUserProperties() );
-                }
-            }
+            Properties commandLineProperties = mergeExecutionPropertiesWithSystemPropertiew( session );
 
             for ( final Enumeration<Object> e = commandLineProperties.keys(); e.hasMoreElements(); )
             {
@@ -417,6 +409,25 @@ public class DefaultAssemblyReader
         return assembly;
     }
 
+    public static Properties mergeExecutionPropertiesWithSystemPropertiew( MavenSession session )
+    {
+        Properties commandLineProperties = System.getProperties();
+        if ( session != null )
+        {
+            commandLineProperties = new Properties();
+            if ( session.getExecutionProperties() != null )
+            {
+                commandLineProperties.putAll( session.getExecutionProperties() );
+            }
+
+            if ( session.getUserProperties() != null )
+            {
+                commandLineProperties.putAll( session.getUserProperties() );
+            }
+        }
+        return commandLineProperties;
+    }
+
     private void debugPrintAssembly( final String message, final Assembly assembly )
     {
         final StringWriter sWriter = new StringWriter();
@@ -460,36 +471,48 @@ public class DefaultAssemblyReader
 
         final List<String> componentLocations = assembly.getComponentDescriptors();
 
-        for (String location : componentLocations) {
+        for ( String location : componentLocations )
+        {
             // allow expressions in path to component descriptor... MASSEMBLY-486
-            try {
-                location = aee.evaluate(location).toString();
-            } catch (final Exception eee) {
-                getLogger().error("Error interpolating componentDescriptor: " + location, eee);
+            try
+            {
+                location = aee.evaluate( location ).toString();
+            }
+            catch ( final Exception eee )
+            {
+                getLogger().error( "Error interpolating componentDescriptor: " + location, eee );
             }
 
-            final Location resolvedLocation = locator.resolve(location);
+            final Location resolvedLocation = locator.resolve( location );
 
-            if (resolvedLocation == null) {
-                throw new AssemblyReadException("Failed to locate component descriptor: " + location);
+            if ( resolvedLocation == null )
+            {
+                throw new AssemblyReadException( "Failed to locate component descriptor: " + location );
             }
 
             Component component = null;
             Reader reader = null;
-            try {
-                reader = new InputStreamReader(resolvedLocation.getInputStream());
-                component = new ComponentXpp3Reader().read(reader);
-            } catch (final IOException e) {
-                throw new AssemblyReadException("Error reading component descriptor: " + location + " (resolved to: "
-                        + resolvedLocation.getSpecification() + ")", e);
-            } catch (final XmlPullParserException e) {
-                throw new AssemblyReadException("Error reading component descriptor: " + location + " (resolved to: "
-                        + resolvedLocation.getSpecification() + ")", e);
-            } finally {
-                IOUtil.close(reader);
+            try
+            {
+                reader = new InputStreamReader( resolvedLocation.getInputStream() );
+                component = new ComponentXpp3Reader().read( reader );
+            }
+            catch ( final IOException e )
+            {
+                throw new AssemblyReadException( "Error reading component descriptor: " + location + " (resolved to: "
+                    + resolvedLocation.getSpecification() + ")", e );
+            }
+            catch ( final XmlPullParserException e )
+            {
+                throw new AssemblyReadException( "Error reading component descriptor: " + location + " (resolved to: "
+                    + resolvedLocation.getSpecification() + ")", e );
+            }
+            finally
+            {
+                IOUtil.close( reader );
             }
 
-            mergeComponentWithAssembly(component, assembly);
+            mergeComponentWithAssembly( component, assembly );
         }
     }
 
@@ -504,32 +527,37 @@ public class DefaultAssemblyReader
         final List<ContainerDescriptorHandlerConfig> containerHandlerDescriptors =
             component.getContainerDescriptorHandlers();
 
-        for (final ContainerDescriptorHandlerConfig cfg : containerHandlerDescriptors) {
-            assembly.addContainerDescriptorHandler(cfg);
+        for ( final ContainerDescriptorHandlerConfig cfg : containerHandlerDescriptors )
+        {
+            assembly.addContainerDescriptorHandler( cfg );
         }
 
         final List<DependencySet> dependencySetList = component.getDependencySets();
 
-        for (final DependencySet dependencySet : dependencySetList) {
-            assembly.addDependencySet(dependencySet);
+        for ( final DependencySet dependencySet : dependencySetList )
+        {
+            assembly.addDependencySet( dependencySet );
         }
 
         final List<FileSet> fileSetList = component.getFileSets();
 
-        for (final FileSet fileSet : fileSetList) {
-            assembly.addFileSet(fileSet);
+        for ( final FileSet fileSet : fileSetList )
+        {
+            assembly.addFileSet( fileSet );
         }
 
         final List<FileItem> fileList = component.getFiles();
 
-        for (final FileItem fileItem : fileList) {
-            assembly.addFile(fileItem);
+        for ( final FileItem fileItem : fileList )
+        {
+            assembly.addFile( fileItem );
         }
 
         final List<Repository> repositoriesList = component.getRepositories();
 
-        for (final Repository repository : repositoriesList) {
-            assembly.addRepository(repository);
+        for ( final Repository repository : repositoriesList )
+        {
+            assembly.addRepository( repository );
         }
 
         final List<ModuleSet> moduleSets = component.getModuleSets();

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/io/PrefixedClasspathLocatorStrategy.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/io/PrefixedClasspathLocatorStrategy.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/io/PrefixedClasspathLocatorStrategy.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/io/PrefixedClasspathLocatorStrategy.java Thu Oct 23 21:01:23 2014
@@ -26,7 +26,7 @@ import org.apache.maven.shared.io.loggin
 /**
  * @version $Id$
  */
-public class PrefixedClasspathLocatorStrategy
+class PrefixedClasspathLocatorStrategy
     extends ClasspathResourceLocatorStrategy
 {
 

Modified: maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/io/RelativeFileLocatorStrategy.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/io/RelativeFileLocatorStrategy.java?rev=1633948&r1=1633947&r2=1633948&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/io/RelativeFileLocatorStrategy.java (original)
+++ maven/plugins/branches/MASSEMBLY-704/src/main/java/org/apache/maven/plugin/assembly/io/RelativeFileLocatorStrategy.java Thu Oct 23 21:01:23 2014
@@ -29,11 +29,11 @@ import java.io.File;
 /**
  * @version $Id$
  */
-public class RelativeFileLocatorStrategy
+class RelativeFileLocatorStrategy
     implements LocatorStrategy
 {
 
-    private File basedir;
+    private final File basedir;
 
     public RelativeFileLocatorStrategy( File basedir )
     {