You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2013/04/02 12:28:02 UTC

svn commit: r1463473 - in /maven/plugins/trunk/maven-dependency-plugin/src: main/java/org/apache/maven/plugin/dependency/ main/java/org/apache/maven/plugin/dependency/fromConfiguration/ main/java/org/apache/maven/plugin/dependency/utils/ main/java/org/...

Author: olamy
Date: Tue Apr  2 10:28:02 2013
New Revision: 1463473

URL: http://svn.apache.org/r1463473
Log:
[MDEP-295] Add ability to strip classifier
Submitted by Holger Mense.

Modified:
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractFromDependenciesMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/BuildClasspathMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/CopyDependenciesMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/AbstractFromConfigurationMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/CopyMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/ProcessArtifactItemsRequest.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/UnpackMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/DestFileFilter.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestCopyMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/filters/TestDestFileFilter.java

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractFromDependenciesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractFromDependenciesMojo.java?rev=1463473&r1=1463472&r2=1463473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractFromDependenciesMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractFromDependenciesMojo.java Tue Apr  2 10:28:02 2013
@@ -39,6 +39,12 @@ public abstract class AbstractFromDepend
      */
     @Parameter( property = "mdep.stripVersion", defaultValue = "false" )
     protected boolean stripVersion = false;
+    
+    /**
+     * Strip artifact classifier during copy
+     */
+    @Parameter( property = "mdep.stripClassifier", defaultValue = "false" )
+    protected boolean stripClassifier = false;
 
     /**
      * Default location used for mojo unless overridden in ArtifactItem

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/BuildClasspathMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/BuildClasspathMojo.java?rev=1463473&r1=1463472&r2=1463473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/BuildClasspathMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/BuildClasspathMojo.java Tue Apr  2 10:28:02 2013
@@ -68,6 +68,12 @@ public class BuildClasspathMojo
     private boolean stripVersion = false;
 
     /**
+     * Strip artifact classifier during copy (only works if prefix is set)
+     */
+    @Parameter( property = "mdep.stripClassifier", defaultValue = "false" )
+    private boolean stripClassifier = false;
+    
+    /**
      * The prefix to prepend on each dependent artifact. If undefined, the paths refer to the actual files store in the
      * local repository (the stripVersion parameter does nothing then).
      */
@@ -295,7 +301,7 @@ public class BuildClasspathMojo
             // TODO: add param for prepending groupId and version.
             sb.append( prefix );
             sb.append( File.separator );
-            sb.append( DependencyUtil.getFormattedFileName( art, this.stripVersion, this.prependGroupId, this.useBaseVersion ) );
+            sb.append( DependencyUtil.getFormattedFileName( art, this.stripVersion, this.prependGroupId, this.useBaseVersion, this.stripClassifier ) );
         }
     }
 

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/CopyDependenciesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/CopyDependenciesMojo.java?rev=1463473&r1=1463472&r2=1463473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/CopyDependenciesMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/CopyDependenciesMojo.java Tue Apr  2 10:28:02 2013
@@ -99,7 +99,7 @@ public class CopyDependenciesMojo
         {
             for ( Artifact artifact : artifacts )
             {
-                copyArtifact( artifact, isStripVersion(), this.prependGroupId, this.useBaseVersion );
+                copyArtifact( artifact, isStripVersion(), this.prependGroupId, this.useBaseVersion, this.stripClassifier );
             }
         }
         else
@@ -132,7 +132,7 @@ public class CopyDependenciesMojo
         {
             copyPoms( getOutputDirectory(), artifacts, this.stripVersion );
             copyPoms( getOutputDirectory(), skippedArtifacts,
-                      this.stripVersion );  // Artifacts that already exist may not already have poms.
+                      this.stripVersion, this.stripClassifier );  // Artifacts that already exist may not already have poms.
         }
     }
 
@@ -196,9 +196,30 @@ public class CopyDependenciesMojo
     protected void copyArtifact( Artifact artifact, boolean removeVersion, boolean prependGroupId, 
     		boolean useBaseVersion ) throws MojoExecutionException
     {
+        copyArtifact(artifact, removeVersion, prependGroupId, useBaseVersion, false);
+    }
+
+    /**
+     * Copies the Artifact after building the destination file name if
+     * overridden. This method also checks if the classifier is set and adds it
+     * to the destination file name if needed.
+     *
+     * @param artifact       representing the object to be copied.
+     * @param removeVersion  specifies if the version should be removed from the file name
+     *                       when copying.
+     * @param prependGroupId specifies if the groupId should be prepend to the file while copying.
+     * @param useBaseVersion specifies if the baseVersion of the artifact should be used instead of the version.
+     * @param removeClassifier specifies if the classifier should be removed from the file name when copying.
+     * @throws MojoExecutionException with a message if an error occurs.
+     * @see DependencyUtil#copyFile(File, File, Log)
+     * @see DependencyUtil#getFormattedFileName(Artifact, boolean)
+     */
+    protected void copyArtifact( Artifact artifact, boolean removeVersion, boolean prependGroupId, 
+            boolean useBaseVersion, boolean removeClassifier ) throws MojoExecutionException
+    {
 
         String destFileName = DependencyUtil.getFormattedFileName( artifact, removeVersion, prependGroupId, 
-        		useBaseVersion );
+                useBaseVersion, removeClassifier );
 
         File destDir;
         destDir = DependencyUtil.getFormattedOutputDirectory( useSubDirectoryPerScope, useSubDirectoryPerType,
@@ -208,7 +229,7 @@ public class CopyDependenciesMojo
 
         copyFile( artifact.getFile(), destFile );
     }
-
+    
     /**
      * Copy the pom files associated with the artifacts.
      */
@@ -216,6 +237,16 @@ public class CopyDependenciesMojo
         throws MojoExecutionException
 
     {
+        copyPoms(destDir, artifacts, removeVersion, false);
+    }
+    
+    /**
+     * Copy the pom files associated with the artifacts.
+     */
+    public void copyPoms( File destDir, Set<Artifact> artifacts, boolean removeVersion, boolean removeClassifier )
+        throws MojoExecutionException
+
+    {
         for ( Artifact artifact : artifacts )
         {
             Artifact pomArtifact = getResolvedPomArtifact( artifact );
@@ -224,7 +255,7 @@ public class CopyDependenciesMojo
             if ( pomArtifact.getFile() != null && pomArtifact.getFile().exists() )
             {
                 File pomDestFile = new File( destDir, DependencyUtil.getFormattedFileName( pomArtifact, removeVersion,
-                                                                                           prependGroupId, useBaseVersion ) );
+                                                                                           prependGroupId, useBaseVersion, removeClassifier ) );
                 if ( !pomDestFile.exists() )
                 {
                     copyFile( pomArtifact.getFile(), pomDestFile );

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/AbstractFromConfigurationMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/AbstractFromConfigurationMojo.java?rev=1463473&r1=1463472&r2=1463473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/AbstractFromConfigurationMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/AbstractFromConfigurationMojo.java Tue Apr  2 10:28:02 2013
@@ -154,6 +154,8 @@ public abstract class AbstractFromConfig
         boolean removeVersion = processArtifactItemsRequest.isRemoveVersion(), prependGroupId =
             processArtifactItemsRequest.isPrependGroupId(), useBaseVersion =
             processArtifactItemsRequest.isUseBaseVersion();
+        
+        boolean removeClassifier = processArtifactItemsRequest.isRemoveClassifier();
 
         if ( artifactItems == null || artifactItems.size() < 1 )
         {
@@ -181,7 +183,7 @@ public abstract class AbstractFromConfig
             if ( StringUtils.isEmpty( artifactItem.getDestFileName() ) )
             {
                 artifactItem.setDestFileName(
-                    DependencyUtil.getFormattedFileName( artifactItem.getArtifact(), removeVersion, prependGroupId, useBaseVersion ) );
+                    DependencyUtil.getFormattedFileName( artifactItem.getArtifact(), removeVersion, prependGroupId, useBaseVersion, removeClassifier) );
             }
 
             try

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/CopyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/CopyMojo.java?rev=1463473&r1=1463472&r2=1463473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/CopyMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/CopyMojo.java Tue Apr  2 10:28:02 2013
@@ -49,6 +49,12 @@ public class CopyMojo
     private boolean stripVersion = false;
 
     /**
+     * Strip artifact classifier during copy
+     */
+    @Parameter( property = "mdep.stripClassifier", defaultValue = "false" )
+    private boolean stripClassifier = false;
+    
+    /**
      * Prepend artifact groupId during copy
      * @since 2.7
      */
@@ -85,7 +91,7 @@ public class CopyMojo
         verifyRequirements();
 
         List<ArtifactItem> theArtifactItems = getProcessedArtifactItems(
-            new ProcessArtifactItemsRequest( this.stripVersion, this.prependGroupId, this.useBaseVersion ) );
+            new ProcessArtifactItemsRequest( this.stripVersion, this.prependGroupId, this.useBaseVersion, this.stripClassifier ) );
         for ( ArtifactItem artifactItem : theArtifactItems )
         {
             if ( artifactItem.isNeedsProcessing() )
@@ -138,6 +144,22 @@ public class CopyMojo
     {
         this.stripVersion = stripVersion;
     }
+    
+    /**
+     * @return Returns the stripClassifier.
+     */
+    public boolean isStripClassifier()
+    {
+        return this.stripClassifier;
+    }
+
+    /**
+     * @param stripClassifier The stripClassifier to set.
+     */
+    public void setStripClassifier( boolean stripClassifier )
+    {
+        this.stripClassifier = stripClassifier;
+    }
 
     /**
      * @param useBaseVersion The useBaseVersion to set.

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/ProcessArtifactItemsRequest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/ProcessArtifactItemsRequest.java?rev=1463473&r1=1463472&r2=1463473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/ProcessArtifactItemsRequest.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/ProcessArtifactItemsRequest.java Tue Apr  2 10:28:02 2013
@@ -29,6 +29,11 @@ public class ProcessArtifactItemsRequest
      */
     private boolean removeVersion;
 
+    /** 
+     * remove the classifier from the filename.
+     */
+    private boolean removeClassifier;
+    
     /**
      * prepend the groupId to the filename.
      */
@@ -44,11 +49,12 @@ public class ProcessArtifactItemsRequest
         // no op
     }
 
-    public ProcessArtifactItemsRequest( boolean removeVersion, boolean prependGroupId, boolean useBaseVersion )
+    public ProcessArtifactItemsRequest( boolean removeVersion, boolean prependGroupId, boolean useBaseVersion, boolean removeClassifier )
     {
         this.removeVersion = removeVersion;
         this.prependGroupId = prependGroupId;
         this.useBaseVersion = useBaseVersion;
+        this.removeClassifier = removeClassifier;
     }
 
     public boolean isRemoveVersion()
@@ -61,6 +67,17 @@ public class ProcessArtifactItemsRequest
         this.removeVersion = removeVersion;
     }
 
+    public boolean isRemoveClassifier()
+    {
+        return removeClassifier;
+    }
+
+    public void setRemoveClassifier( boolean removeClassifier )
+    {
+        this.removeClassifier = removeClassifier;
+    }
+
+    
     public ProcessArtifactItemsRequest removeVersion( boolean removeVersion )
     {
         this.removeVersion = removeVersion;

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/UnpackMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/UnpackMojo.java?rev=1463473&r1=1463472&r2=1463473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/UnpackMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/UnpackMojo.java Tue Apr  2 10:28:02 2013
@@ -142,7 +142,7 @@ public final class UnpackMojo
         throws MojoExecutionException
     {
         List<ArtifactItem> items =
-            super.getProcessedArtifactItems( new ProcessArtifactItemsRequest( removeVersion, false, false ) );
+            super.getProcessedArtifactItems( new ProcessArtifactItemsRequest( removeVersion, false, false, false ) );
         for ( ArtifactItem artifactItem : items )
         {
             if ( StringUtils.isEmpty( artifactItem.getIncludes() ) )

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java?rev=1463473&r1=1463472&r2=1463473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/DependencyUtil.java Tue Apr  2 10:28:02 2013
@@ -93,6 +93,31 @@ public final class DependencyUtil
     public static String getFormattedFileName( Artifact artifact, boolean removeVersion, boolean prependGroupId, 
     		boolean useBaseVersion )
     {
+        return getFormattedFileName(artifact, removeVersion, prependGroupId, useBaseVersion, false);
+    }
+
+    /**
+     * Builds the file name. If removeVersion is set, then the file name must be
+     * reconstructed from the groupId (if <b>prependGroupId</b> is true) artifactId,
+     * Classifier (if used) and Type.
+     * Otherwise, this method returns the artifact file name.
+     * 
+     * @param artifact
+     *            File to be formatted.
+     * @param removeVersion
+     *            Specifies if the version should be removed from the file name.
+     * @param prependGroupId
+     *            Specifies if the groupId should be prepended to the file name.
+     * @param useBaseVersion
+     *            Specifies if the baseVersion of the artifact should be used instead of the version.
+     * @param removeClassifier
+     *            Specifies if the classifier of the artifact should be remved from the file name.
+     * @return Formatted file name in the format
+     *         [groupId].artifactId-[version]-[classifier].[type]
+     */
+    public static String getFormattedFileName( Artifact artifact, boolean removeVersion, boolean prependGroupId, 
+            boolean useBaseVersion, boolean removeClassifier )
+    {
         StringBuilder destFileName = new StringBuilder();
         
         if ( prependGroupId )
@@ -119,7 +144,7 @@ public final class DependencyUtil
 
         String classifierString = "";
 
-        if ( StringUtils.isNotEmpty( artifact.getClassifier() ) )
+        if (!removeClassifier && StringUtils.isNotEmpty( artifact.getClassifier() ) )
         {
             classifierString = "-" + artifact.getClassifier();
         }
@@ -129,7 +154,7 @@ public final class DependencyUtil
         
         return destFileName.toString();
     }
-
+    
     /**
      * Formats the outputDirectory based on type.
      * 

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/DestFileFilter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/DestFileFilter.java?rev=1463473&r1=1463472&r2=1463473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/DestFileFilter.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/DestFileFilter.java Tue Apr  2 10:28:02 2013
@@ -53,6 +53,8 @@ public class DestFileFilter
     private boolean useRepositoryLayout;
 
     private boolean removeVersion;
+    
+    private boolean removeClassifier;
 
     private File outputFileDirectory;
 
@@ -66,6 +68,7 @@ public class DestFileFilter
         useSubDirectoryPerType = false;
         useSubDirectoryPerScope = false;
         removeVersion = false;
+        removeClassifier = false;
     }
 
     public DestFileFilter( boolean overWriteReleases, boolean overWriteSnapshots, boolean overWriteIfNewer,
@@ -190,6 +193,23 @@ public class DestFileFilter
     {
         this.removeVersion = removeVersion;
     }
+    
+    /**
+     * @return Returns the removeClassifier.
+     */
+    public boolean isRemoveClassifier()
+    {
+        return this.removeClassifier;
+    }
+
+    /**
+     * @param removeClassifier
+     *            The removeClassifier to set.
+     */
+    public void setRemoveClassifier( boolean removeClassifier )
+    {
+        this.removeClassifier = removeClassifier;
+    }
 
     /**
      * @return Returns the useSubDirectoryPerArtifact.

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo.java?rev=1463473&r1=1463472&r2=1463473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo.java Tue Apr  2 10:28:02 2013
@@ -130,6 +130,22 @@ public class TestCopyDependenciesMojo
             assertTrue( file.exists() );
         }
     }
+    
+    public void testStripClassifier()
+            throws Exception
+        {
+            mojo.stripClassifier = true;
+            mojo.execute();
+
+            Set<Artifact> artifacts = mojo.project.getArtifacts();
+            for ( Artifact artifact : artifacts )
+            {
+                String fileName = DependencyUtil.getFormattedFileName( artifact, false, false, false, true );
+                File file = new File( mojo.outputDirectory, fileName );
+                assertTrue( file.exists() );
+            }
+        }
+
 
     public void testUseBaseVersion()
         throws Exception

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestCopyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestCopyMojo.java?rev=1463473&r1=1463472&r2=1463473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestCopyMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestCopyMojo.java Tue Apr  2 10:28:02 2013
@@ -70,7 +70,7 @@ public class TestCopyMojo
     public ArtifactItem getSingleArtifactItem( boolean removeVersion, boolean useBaseVersion )
         throws MojoExecutionException
     {
-        List<ArtifactItem> list = mojo.getProcessedArtifactItems(new ProcessArtifactItemsRequest( removeVersion, false, useBaseVersion ));
+        List<ArtifactItem> list = mojo.getProcessedArtifactItems(new ProcessArtifactItemsRequest( removeVersion, false, useBaseVersion, false ));
         return list.get( 0 );
     }
 
@@ -118,6 +118,7 @@ public class TestCopyMojo
 
         assertFalse( themojo.isStripVersion() );
         assertFalse( themojo.isSkip() );
+        assertFalse( themojo.isStripClassifier() );
     }
 
     public void testCopyFile()
@@ -217,6 +218,22 @@ public class TestCopyMojo
         assertFilesExist( list, true );
     }
 
+    public void testCopyStripClassifierSetInMojo()
+            throws Exception
+        {
+            List<ArtifactItem> list = stubFactory.getArtifactItems( stubFactory.getClassifiedArtifacts() );
+            ArtifactItem item = (ArtifactItem) list.get( 0 );
+            item.setOutputDirectory( new File( mojo.getOutputDirectory(), "testOverride" ) );
+            mojo.setStripClassifier( true );
+
+            mojo.setArtifactItems( list );
+
+            mojo.execute();
+            assertEquals( DependencyUtil.getFormattedFileName( item.getArtifact(), false, false, false, true ), item.getDestFileName() );
+
+            assertFilesExist( list, true );
+        }
+    
     public void testNonClassifierStrip()
         throws Exception
     {
@@ -535,7 +552,7 @@ public class TestCopyMojo
     {
         try
         {
-            mojo.getProcessedArtifactItems( new ProcessArtifactItemsRequest( false, false, false ) );
+            mojo.getProcessedArtifactItems( new ProcessArtifactItemsRequest( false, false, false, false ) );
             fail( "Expected Exception" );
         }
         catch ( MojoExecutionException e )

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java?rev=1463473&r1=1463472&r2=1463473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/TestDependencyUtil.java Tue Apr  2 10:28:02 2013
@@ -244,13 +244,16 @@ public class TestDependencyUtil
         name = DependencyUtil.getFormattedFileName( artifact, true );
         expectedResult = "two-sources.jar";
         assertEquals( expectedResult, name );
-
+        
+        name = DependencyUtil.getFormattedFileName(artifact, false, false, false, true);
+        expectedResult = "two-1.1-SNAPSHOT.jar";
+        assertEquals( expectedResult, name );
+        
         ah = new DefaultArtifactHandlerStub( "war", null );
         artifact = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "war", "", ah, false );
         name = DependencyUtil.getFormattedFileName( artifact, true );
         expectedResult = "two.war";
         assertEquals( expectedResult, name );
-
     }
 
     public void testFileNameClassifierWithFile()
@@ -271,10 +274,14 @@ public class TestDependencyUtil
         String expectedResult = "two-1.1-SNAPSHOT-sources.war";
         assertEquals( expectedResult, name );
 
+        name = DependencyUtil.getFormattedFileName( artifact, false, false, false, true );
+        expectedResult = "two-1.1-SNAPSHOT.war";
+        assertEquals( expectedResult, name );
+        
         name = DependencyUtil.getFormattedFileName( artifact, true );
         expectedResult = "two-sources.war";
         assertEquals( expectedResult, name );
-
+        
         artifact = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "war", "", ah, false );
         name = DependencyUtil.getFormattedFileName( artifact, true );
         expectedResult = "two.war";

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/filters/TestDestFileFilter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/filters/TestDestFileFilter.java?rev=1463473&r1=1463472&r2=1463473&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/filters/TestDestFileFilter.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/filters/TestDestFileFilter.java Tue Apr  2 10:28:02 2013
@@ -76,16 +76,23 @@ public class TestDestFileFilter
     }
 
     public File createFile( Artifact artifact, boolean useSubDirectoryPerArtifact, boolean useSubDirectoryPerType,
-                           boolean removeVersion )
+                           boolean removeVersion)
         throws IOException
     {
+        return createFile(artifact, useSubDirectoryPerArtifact, useSubDirectoryPerType, removeVersion, false);
+    }
+    
+    public File createFile(Artifact artifact, boolean useSubDirectoryPerArtifact, boolean useSubDirectoryPerType,
+            boolean removeVersion, boolean removeClassifier)
+            throws IOException
+    {
         File destFolder =
-            DependencyUtil.getFormattedOutputDirectory( false, useSubDirectoryPerType, useSubDirectoryPerArtifact,
-                                                        false, false, outputFolder, artifact );
-        File destFile = new File( destFolder, DependencyUtil.getFormattedFileName( artifact, removeVersion ) );
+                DependencyUtil.getFormattedOutputDirectory(false, useSubDirectoryPerType, useSubDirectoryPerArtifact,
+                        false, false, outputFolder, artifact);
+        File destFile = new File(destFolder, DependencyUtil.getFormattedFileName(artifact, removeVersion, false, false, removeClassifier));
 
         destFile.getParentFile().mkdirs();
-        assertTrue( destFile.createNewFile() );
+        assertTrue(destFile.createNewFile());
         return destFile;
     }
 
@@ -132,6 +139,21 @@ public class TestDestFileFilter
         assertTrue( filter.isArtifactIncluded( artifact ) );
     }
 
+    public void testDestFileStripClassifier()
+            throws IOException, ArtifactFilterException
+    {
+        DestFileFilter filter = new DestFileFilter(outputFolder);
+        Artifact artifact = fact.getSnapshotArtifact();
+        filter.setRemoveClassifier(true);
+
+        assertTrue(filter.isArtifactIncluded(artifact));
+        createFile(artifact, false, false, false, true);
+        assertFalse(filter.isArtifactIncluded(artifact));
+
+        filter.setOverWriteSnapshots(true);
+        assertTrue(filter.isArtifactIncluded(artifact));
+    }
+    
     public void testDestFileSubPerArtifact()
         throws  IOException, ArtifactFilterException
     {