You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2010/05/28 04:49:44 UTC

svn commit: r949077 - in /maven/plugins/trunk/maven-dependency-plugin/src: main/java/org/apache/maven/plugin/dependency/fromConfiguration/ test/java/org/apache/maven/plugin/dependency/fromConfiguration/

Author: brianf
Date: Fri May 28 02:49:44 2010
New Revision: 949077

URL: http://svn.apache.org/viewvc?rev=949077&view=rev
Log:
MDEP-250 add a skip parameter to copy/unpack

Modified:
    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/UnpackMojo.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/fromConfiguration/TestUnpackMojo.java

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=949077&r1=949076&r2=949077&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 Fri May 28 02:49:44 2010
@@ -40,23 +40,29 @@ import org.apache.maven.shared.artifact.
 import org.codehaus.plexus.util.StringUtils;
 
 /**
- * Abstract Parent class used by mojos that get Artifact information from the
- * plugin configuration as an ArrayList of ArtifactItems
- *
+ * Abstract Parent class used by mojos that get Artifact information from the plugin configuration as an ArrayList of
+ * ArtifactItems
+ * 
  * @see ArtifactItem
  * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
  * @version $Id$
- *
  */
 public abstract class AbstractFromConfigurationMojo
     extends AbstractDependencyMojo
 {
+    /**
+     * Skip the execution
+     * 
+     * @optional
+     * @since 2.2
+     * @parameter expression="${mdep.skip}" default-value="false"
+     */
+    private boolean skip;
 
     /**
      * Default location used for mojo unless overridden in ArtifactItem
-     *
-     * @parameter expression="${outputDirectory}"
-     *            default-value="${project.build.directory}/dependency"
+     * 
+     * @parameter expression="${outputDirectory}" default-value="${project.build.directory}/dependency"
      * @optional
      * @since 1.0
      */
@@ -64,7 +70,7 @@ public abstract class AbstractFromConfig
 
     /**
      * Overwrite release artifacts
-     *
+     * 
      * @optional
      * @since 1.0
      * @parameter expression="${mdep.overWriteReleases}" default-value="false"
@@ -73,7 +79,7 @@ public abstract class AbstractFromConfig
 
     /**
      * Overwrite snapshot artifacts
-     *
+     * 
      * @optional
      * @since 1.0
      * @parameter expression="${mdep.overWriteSnapshots}" default-value="false"
@@ -82,7 +88,7 @@ public abstract class AbstractFromConfig
 
     /**
      * Overwrite if newer
-     *
+     * 
      * @optional
      * @since 2.0
      * @parameter expression="${mdep.overIfNewer}" default-value="true"
@@ -90,10 +96,9 @@ public abstract class AbstractFromConfig
     private boolean overWriteIfNewer;
 
     /**
-     * Collection of ArtifactItems to work on. (ArtifactItem contains groupId,
-     * artifactId, version, type, classifier, location, destFileName, markerFile and overwrite.)
-     * See <a href="./usage.html">Usage</a> for details.
-     *
+     * Collection of ArtifactItems to work on. (ArtifactItem contains groupId, artifactId, version, type, classifier,
+     * location, destFileName, markerFile and overwrite.) See <a href="./usage.html">Usage</a> for details.
+     * 
      * @parameter
      * @required
      * @since 1.0
@@ -102,18 +107,20 @@ public abstract class AbstractFromConfig
 
     /**
      * To look up ArtifactRepository implementation
+     * 
      * @component
      * @readonly
      */
     private ArtifactRepositoryFactory artifactRepositoryManager;
 
     /**
-     * Path to override default local repository during plugin's execution.
-     * To remove all downloaded artifacts as part of the build, set this value to a location under your project's target directory
+     * Path to override default local repository during plugin's execution. To remove all downloaded artifacts as part
+     * of the build, set this value to a location under your project's target directory
+     * 
      * @parameter
      * @since 2.2
      */
-    private  File localRepositoryDirectory;
+    private File localRepositoryDirectory;
 
     /**
      * To host and cache localRepositoryDirectory
@@ -123,17 +130,12 @@ public abstract class AbstractFromConfig
     abstract ArtifactItemFilter getMarkedArtifactFilter( ArtifactItem item );
 
     /**
-     * Preprocesses the list of ArtifactItems. This method defaults the
-     * outputDirectory if not set and creates the output Directory if it doesn't
-     * exist.
-     *
-     * @param removeVersion
-     *            remove the version from the filename.
+     * Preprocesses the list of ArtifactItems. This method defaults the outputDirectory if not set and creates the
+     * output Directory if it doesn't exist.
+     * 
+     * @param removeVersion remove the version from the filename.
      * @return An ArrayList of preprocessed ArtifactItems
-     *
-     * @throws MojoExecutionException
-     *             with a message if an error occurs.
-     *
+     * @throws MojoExecutionException with a message if an error occurs.
      * @see ArtifactItem
      */
     protected ArrayList getProcessedArtifactItems( boolean removeVersion )
@@ -199,18 +201,12 @@ public abstract class AbstractFromConfig
     }
 
     /**
-     * Resolves the Artifact from the remote repository if nessessary. If no
-     * version is specified, it will be retrieved from the dependency list or
-     * from the DependencyManagement section of the pom.
-     *
-     * @param artifactItem
-     *            containing information about artifact from plugin
-     *            configuration.
+     * Resolves the Artifact from the remote repository if nessessary. If no version is specified, it will be retrieved
+     * from the dependency list or from the DependencyManagement section of the pom.
+     * 
+     * @param artifactItem containing information about artifact from plugin configuration.
      * @return Artifact object representing the specified file.
-     *
-     * @throws MojoExecutionException
-     *             with a message if the version can't be found in
-     *             DependencyManagement.
+     * @throws MojoExecutionException with a message if the version can't be found in DependencyManagement.
      */
     protected Artifact getArtifact( ArtifactItem artifactItem )
         throws MojoExecutionException
@@ -233,14 +229,16 @@ public abstract class AbstractFromConfig
 
         if ( StringUtils.isEmpty( artifactItem.getClassifier() ) )
         {
-            artifact = factory.createDependencyArtifact( artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
-                                                         artifactItem.getType(), null, Artifact.SCOPE_COMPILE );
+            artifact =
+                factory.createDependencyArtifact( artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
+                                                  artifactItem.getType(), null, Artifact.SCOPE_COMPILE );
         }
         else
         {
-            artifact = factory.createDependencyArtifact( artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
-                                                         artifactItem.getType(), artifactItem.getClassifier(),
-                                                         Artifact.SCOPE_COMPILE );
+            artifact =
+                factory.createDependencyArtifact( artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
+                                                  artifactItem.getType(), artifactItem.getClassifier(),
+                                                  Artifact.SCOPE_COMPILE );
         }
 
         try
@@ -248,17 +246,12 @@ public abstract class AbstractFromConfig
             // mdep-50 - rolledback for now because it's breaking some
             // functionality.
             /*
-             * List listeners = new ArrayList();
-             *
-             * Set theSet = new HashSet(); theSet.add( artifact );
-             * ArtifactResolutionResult artifactResolutionResult =
-             * artifactCollector.collect( theSet, project .getArtifact(),
-             * managedVersions, this.local,
-             * project.getRemoteArtifactRepositories(), artifactMetadataSource,
-             * null, listeners ); Iterator iter =
-             * artifactResolutionResult.getArtifactResolutionNodes().iterator();
-             * while ( iter.hasNext() ) { ResolutionNode node = (ResolutionNode)
-             * iter.next(); artifact = node.getArtifact(); }
+             * List listeners = new ArrayList(); Set theSet = new HashSet(); theSet.add( artifact );
+             * ArtifactResolutionResult artifactResolutionResult = artifactCollector.collect( theSet, project
+             * .getArtifact(), managedVersions, this.local, project.getRemoteArtifactRepositories(),
+             * artifactMetadataSource, null, listeners ); Iterator iter =
+             * artifactResolutionResult.getArtifactResolutionNodes().iterator(); while ( iter.hasNext() ) {
+             * ResolutionNode node = (ResolutionNode) iter.next(); artifact = node.getArtifact(); }
              */
 
             resolver.resolve( artifact, remoteRepos, getLocal() );
@@ -276,24 +269,26 @@ public abstract class AbstractFromConfig
     }
 
     /**
-     * Tries to find missing version from dependancy list and dependency
-     * management. If found, the artifact is updated with the correct version.
-     *
-     * It will first look for an exact match on artifactId/groupId/classifier/type and if it doesn't find
-     * a match, it will try again looking for artifactId and groupId only.
-     * @param artifact
-     *            representing configured file.
+     * Tries to find missing version from dependancy list and dependency management. If found, the artifact is updated
+     * with the correct version. It will first look for an exact match on artifactId/groupId/classifier/type and if it
+     * doesn't find a match, it will try again looking for artifactId and groupId only.
+     * 
+     * @param artifact representing configured file.
      * @throws MojoExecutionException
      */
     private void fillMissingArtifactVersion( ArtifactItem artifact )
         throws MojoExecutionException
     {
         if ( !findDependencyVersion( artifact, project.getDependencies(), false )
-            && ( project.getDependencyManagement() == null || !findDependencyVersion( artifact, project
-                .getDependencyManagement().getDependencies(), false ) )
+            && ( project.getDependencyManagement() == null || !findDependencyVersion(
+                                                                                      artifact,
+                                                                                      project.getDependencyManagement().getDependencies(),
+                                                                                      false ) )
             && !findDependencyVersion( artifact, project.getDependencies(), true )
-            && ( project.getDependencyManagement() == null || !findDependencyVersion( artifact, project
-                .getDependencyManagement().getDependencies(), true ) ) )
+            && ( project.getDependencyManagement() == null || !findDependencyVersion(
+                                                                                      artifact,
+                                                                                      project.getDependencyManagement().getDependencies(),
+                                                                                      true ) ) )
         {
             throw new MojoExecutionException( "Unable to find artifact version of " + artifact.getGroupId() + ":"
                 + artifact.getArtifactId() + " in either dependency list or in project's dependency management." );
@@ -301,15 +296,12 @@ public abstract class AbstractFromConfig
     }
 
     /**
-     * Tries to find missing version from a list of dependencies. If found, the
-     * artifact is updated with the correct version.
-     *
-     * @param artifact
-     *            representing configured file.
-     * @param list
-     *            list of dependencies to search.
-     * @param looseMatch
-     *            only look at artifactId and groupId
+     * Tries to find missing version from a list of dependencies. If found, the artifact is updated with the correct
+     * version.
+     * 
+     * @param artifact representing configured file.
+     * @param list list of dependencies to search.
+     * @param looseMatch only look at artifactId and groupId
      * @return the found dependency
      */
     private boolean findDependencyVersion( ArtifactItem artifact, List list, boolean looseMatch )
@@ -335,46 +327,24 @@ public abstract class AbstractFromConfig
         return result;
     }
 
-   /* private Map createManagedVersionMap( ArtifactFactory artifactFactory, String projectId,
-                                         DependencyManagement dependencyManagement )
-        throws MojoExecutionException
-    {
-        Map map;
-        if ( dependencyManagement != null && dependencyManagement.getDependencies() != null )
-        {
-            map = new HashMap();
-            for ( Iterator i = dependencyManagement.getDependencies().iterator(); i.hasNext(); )
-            {
-                Dependency d = (Dependency) i.next();
-
-                try
-                {
-                    VersionRange versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
-                    Artifact artifact = artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(),
-                                                                                  versionRange, d.getType(), d
-                                                                                      .getClassifier(), d.getScope(), d
-                                                                                      .isOptional() );
-                    map.put( d.getManagementKey(), artifact );
-                }
-                catch ( InvalidVersionSpecificationException e )
-                {
-                    throw new MojoExecutionException( "Unable to parse version", e );
-                }
-            }
-        }
-        else
-        {
-            map = Collections.EMPTY_MAP;
-        }
-        return map;
-    }*/
-
+    /*
+     * private Map createManagedVersionMap( ArtifactFactory artifactFactory, String projectId, DependencyManagement
+     * dependencyManagement ) throws MojoExecutionException { Map map; if ( dependencyManagement != null &&
+     * dependencyManagement.getDependencies() != null ) { map = new HashMap(); for ( Iterator i =
+     * dependencyManagement.getDependencies().iterator(); i.hasNext(); ) { Dependency d = (Dependency) i.next(); try {
+     * VersionRange versionRange = VersionRange.createFromVersionSpec( d.getVersion() ); Artifact artifact =
+     * artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange, d.getType(), d
+     * .getClassifier(), d.getScope(), d .isOptional() ); map.put( d.getManagementKey(), artifact ); } catch (
+     * InvalidVersionSpecificationException e ) { throw new MojoExecutionException( "Unable to parse version", e ); } }
+     * } else { map = Collections.EMPTY_MAP; } return map; }
+     */
 
     /**
      * Override the base to
+     * 
      * @return Returns the local.
      */
-    protected ArtifactRepository getLocal ()
+    protected ArtifactRepository getLocal()
     {
         if ( this.overrideLocalRepository != null )
         {
@@ -383,11 +353,12 @@ public abstract class AbstractFromConfig
 
         if ( this.localRepositoryDirectory != null )
         {
-            //create a new local repo using existing layout, snapshots, and releases policy
-            this.overrideLocalRepository = artifactRepositoryManager.createArtifactRepository(
-                super.getLocal().getId(), "file://"
-                + this.localRepositoryDirectory.getAbsolutePath(), super.getLocal().getLayout(), super.getLocal()
-                .getSnapshots(), super.getLocal().getReleases() );
+            // create a new local repo using existing layout, snapshots, and releases policy
+            this.overrideLocalRepository =
+                artifactRepositoryManager.createArtifactRepository( super.getLocal().getId(), "file://"
+                    + this.localRepositoryDirectory.getAbsolutePath(), super.getLocal().getLayout(),
+                                                                    super.getLocal().getSnapshots(),
+                                                                    super.getLocal().getReleases() );
 
             this.getLog().debug( "Execution local repository is at: " + this.overrideLocalRepository.getBasedir() );
 
@@ -408,8 +379,7 @@ public abstract class AbstractFromConfig
     }
 
     /**
-     * @param theArtifactItems
-     *            The artifactItems to set.
+     * @param theArtifactItems The artifactItems to set.
      */
     public void setArtifactItems( ArrayList theArtifactItems )
     {
@@ -425,8 +395,7 @@ public abstract class AbstractFromConfig
     }
 
     /**
-     * @param theOutputDirectory
-     *            The outputDirectory to set.
+     * @param theOutputDirectory The outputDirectory to set.
      */
     public void setOutputDirectory( File theOutputDirectory )
     {
@@ -442,8 +411,7 @@ public abstract class AbstractFromConfig
     }
 
     /**
-     * @param theOverWriteIfNewer
-     *            The overWriteIfNewer to set.
+     * @param theOverWriteIfNewer The overWriteIfNewer to set.
      */
     public void setOverWriteIfNewer( boolean theOverWriteIfNewer )
     {
@@ -459,8 +427,7 @@ public abstract class AbstractFromConfig
     }
 
     /**
-     * @param theOverWriteReleases
-     *            The overWriteReleases to set.
+     * @param theOverWriteReleases The overWriteReleases to set.
      */
     public void setOverWriteReleases( boolean theOverWriteReleases )
     {
@@ -476,8 +443,7 @@ public abstract class AbstractFromConfig
     }
 
     /**
-     * @param theOverWriteSnapshots
-     *            The overWriteSnapshots to set.
+     * @param theOverWriteSnapshots The overWriteSnapshots to set.
      */
     public void setOverWriteSnapshots( boolean theOverWriteSnapshots )
     {
@@ -488,4 +454,14 @@ public abstract class AbstractFromConfig
     {
         this.localRepositoryDirectory = localRepositoryDirectory;
     }
+
+    public boolean isSkip()
+    {
+        return skip;
+    }
+
+    public void setSkip( boolean skip )
+    {
+        this.skip = skip;
+    }
 }

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=949077&r1=949076&r2=949077&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 Fri May 28 02:49:44 2010
@@ -28,9 +28,8 @@ import org.apache.maven.plugin.dependenc
 import org.apache.maven.plugin.dependency.utils.filters.DestFileFilter;
 
 /**
- * Goal that copies a list of artifacts from the repository to defined
- * locations.
- *
+ * Goal that copies a list of artifacts from the repository to defined locations.
+ * 
  * @goal copy
  * @since 1.0
  * @phase process-sources
@@ -43,19 +42,17 @@ public class CopyMojo
 
     /**
      * Strip artifact version during copy
-     *
+     * 
      * @parameter expression="${mdep.stripVersion}" default-value="false"
      * @parameter
      */
     private boolean stripVersion = false;
 
     /**
-     * Main entry into mojo. This method gets the ArtifactItems and iterates
-     * through each one passing it to copyArtifact.
-     *
-     * @throws MojoExecutionException
-     *             with a message if an error occurs.
-     *
+     * Main entry into mojo. This method gets the ArtifactItems and iterates through each one passing it to
+     * copyArtifact.
+     * 
+     * @throws MojoExecutionException with a message if an error occurs.
      * @see ArtifactItem
      * @see #getArtifactItems
      * @see #copyArtifact(ArtifactItem)
@@ -63,31 +60,30 @@ public class CopyMojo
     public void execute()
         throws MojoExecutionException
     {
-        ArrayList theArtifactItems = getProcessedArtifactItems( this.stripVersion );
-        Iterator iter = theArtifactItems.iterator();
-        while ( iter.hasNext() )
+        if ( !isSkip() )
         {
-            ArtifactItem artifactItem = (ArtifactItem) iter.next();
-            if ( artifactItem.isNeedsProcessing() )
+            ArrayList theArtifactItems = getProcessedArtifactItems( this.stripVersion );
+            Iterator iter = theArtifactItems.iterator();
+            while ( iter.hasNext() )
             {
-                copyArtifact( artifactItem );
-            }
-            else
-            {
-                this.getLog().info( artifactItem + " already exists in " + artifactItem.getOutputDirectory() );
+                ArtifactItem artifactItem = (ArtifactItem) iter.next();
+                if ( artifactItem.isNeedsProcessing() )
+                {
+                    copyArtifact( artifactItem );
+                }
+                else
+                {
+                    this.getLog().info( artifactItem + " already exists in " + artifactItem.getOutputDirectory() );
+                }
             }
         }
     }
 
     /**
-     * Resolves the artifact from the repository and copies it to the specified
-     * location.
-     *
-     * @param artifactItem
-     *            containing the information about the Artifact to copy.
-     * @throws MojoExecutionException
-     *             with a message if an error occurs.
-     *
+     * Resolves the artifact from the repository and copies it to the specified location.
+     * 
+     * @param artifactItem containing the information about the Artifact to copy.
+     * @throws MojoExecutionException with a message if an error occurs.
      * @see DependencyUtil#copyFile(File, File, Log)
      * @see DependencyUtil#getFormattedFileName(Artifact, boolean)
      */
@@ -101,9 +97,9 @@ public class CopyMojo
 
     protected ArtifactItemFilter getMarkedArtifactFilter( ArtifactItem item )
     {
-        ArtifactItemFilter destinationNameOverrideFilter = new DestFileFilter( this.isOverWriteReleases(), this
-            .isOverWriteSnapshots(), this.isOverWriteIfNewer(), false, false, false, this.stripVersion, item
-            .getOutputDirectory() );
+        ArtifactItemFilter destinationNameOverrideFilter =
+            new DestFileFilter( this.isOverWriteReleases(), this.isOverWriteSnapshots(), this.isOverWriteIfNewer(),
+                                false, false, false, this.stripVersion, item.getOutputDirectory() );
         return destinationNameOverrideFilter;
     }
 
@@ -116,8 +112,7 @@ public class CopyMojo
     }
 
     /**
-     * @param stripVersion
-     *            The stripVersion to set.
+     * @param stripVersion The stripVersion to set.
      */
     public void setStripVersion( boolean stripVersion )
     {

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=949077&r1=949076&r2=949077&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 Fri May 28 02:49:44 2010
@@ -31,9 +31,8 @@ import org.apache.maven.plugin.dependenc
 import org.codehaus.plexus.util.StringUtils;
 
 /**
- * Goal that retrieves a list of artifacts from the repository and unpacks them
- * in a defined location.
- *
+ * Goal that retrieves a list of artifacts from the repository and unpacks them in a defined location.
+ * 
  * @since 1.0
  * @goal unpack
  * @phase process-sources
@@ -46,34 +45,36 @@ public final class UnpackMojo
 
     /**
      * Directory to store flag files after unpack
-     *
+     * 
      * @parameter expression="${project.build.directory}/dependency-maven-plugin-markers"
      */
     private File markersDirectory;
 
     /**
-     * A comma separated list of file patterns to include when unpacking the
-     * artifact.  i.e.  **\/*.xml,**\/*.properties NOTE: Excludes patterns override the includes. (component code = return isIncluded( name ) AND !isExcluded( name );)
-     *  @since 2.0-alpha-5
+     * A comma separated list of file patterns to include when unpacking the artifact. i.e. **\/*.xml,**\/*.properties
+     * NOTE: Excludes patterns override the includes. (component code = return isIncluded( name ) AND !isExcluded( name
+     * );)
+     * 
+     * @since 2.0-alpha-5
      * @parameter expression="${mdep.unpack.includes}"
      */
     private String includes;
 
     /**
-     * A comma separated list of file patterns to exclude when unpacking the
-     * artifact.  i.e.  **\/*.xml,**\/*.properties NOTE: Excludes patterns override the includes. (component code = return isIncluded( name ) AND !isExcluded( name );)
+     * A comma separated list of file patterns to exclude when unpacking the artifact. i.e. **\/*.xml,**\/*.properties
+     * NOTE: Excludes patterns override the includes. (component code = return isIncluded( name ) AND !isExcluded( name
+     * );)
+     * 
      * @since 2.0-alpha-5
      * @parameter expression="${mdep.unpack.excludes}"
      */
     private String excludes;
 
     /**
-     * Main entry into mojo. This method gets the ArtifactItems and iterates
-     * through each one passing it to unpackArtifact.
-     *
-     * @throws MojoExecutionException
-     *             with a message if an error occurs.
-     *
+     * Main entry into mojo. This method gets the ArtifactItems and iterates through each one passing it to
+     * unpackArtifact.
+     * 
+     * @throws MojoExecutionException with a message if an error occurs.
      * @see ArtifactItem
      * @see #getArtifactItems
      * @see #unpackArtifact(ArtifactItem)
@@ -81,41 +82,40 @@ public final class UnpackMojo
     public void execute()
         throws MojoExecutionException
     {
-        ArrayList processedItems = getProcessedArtifactItems( false );
-        Iterator iter = processedItems.iterator();
-        while ( iter.hasNext() )
+        if ( !isSkip() )
         {
-            ArtifactItem artifactItem = (ArtifactItem) iter.next();
-            if ( artifactItem.isNeedsProcessing() )
+            ArrayList processedItems = getProcessedArtifactItems( false );
+            Iterator iter = processedItems.iterator();
+            while ( iter.hasNext() )
             {
-                unpackArtifact( artifactItem );
-            }
-            else
-            {
-                this.getLog().info( artifactItem.getArtifact().getFile().getName() + " already unpacked." );
+                ArtifactItem artifactItem = (ArtifactItem) iter.next();
+                if ( artifactItem.isNeedsProcessing() )
+                {
+                    unpackArtifact( artifactItem );
+                }
+                else
+                {
+                    this.getLog().info( artifactItem.getArtifact().getFile().getName() + " already unpacked." );
+                }
             }
         }
     }
 
     /**
      * This method gets the Artifact object and calls DependencyUtil.unpackFile.
-     *
-     * @param artifactItem
-     *            containing the information about the Artifact to unpack.
-     *
-     * @throws MojoExecutionException
-     *             with a message if an error occurs.
-     *
+     * 
+     * @param artifactItem containing the information about the Artifact to unpack.
+     * @throws MojoExecutionException with a message if an error occurs.
      * @see #getArtifact
-     * @see DependencyUtil#unpackFile(Artifact, File, File, ArchiverManager,
-     *      Log)
+     * @see DependencyUtil#unpackFile(Artifact, File, File, ArchiverManager, Log)
      */
     private void unpackArtifact( ArtifactItem artifactItem )
         throws MojoExecutionException
     {
         MarkerHandler handler = new UnpackFileMarkerHandler( artifactItem, this.markersDirectory );
 
-        unpack( artifactItem.getArtifact().getFile(), artifactItem.getOutputDirectory(), artifactItem.getIncludes(), artifactItem.getExcludes() );
+        unpack( artifactItem.getArtifact().getFile(), artifactItem.getOutputDirectory(), artifactItem.getIncludes(),
+                artifactItem.getExcludes() );
         handler.setMarker();
 
     }
@@ -157,29 +157,25 @@ public final class UnpackMojo
     }
 
     /**
-     * @param theMarkersDirectory
-     *            The markersDirectory to set.
+     * @param theMarkersDirectory The markersDirectory to set.
      */
     public void setMarkersDirectory( File theMarkersDirectory )
     {
         this.markersDirectory = theMarkersDirectory;
     }
 
-
     /**
      * @return Returns a comma separated list of excluded items
      */
-    public String getExcludes ()
+    public String getExcludes()
     {
         return this.excludes;
     }
 
     /**
-     * @param excludes
-     * 			A comma separated list of items to exclude
-     * 			i.e.  **\/*.xml, **\/*.properties
+     * @param excludes A comma separated list of items to exclude i.e. **\/*.xml, **\/*.properties
      */
-    public void setExcludes ( String excludes )
+    public void setExcludes( String excludes )
     {
         this.excludes = excludes;
     }
@@ -193,11 +189,9 @@ public final class UnpackMojo
     }
 
     /**
-     * @param includes
-     * 			A comma separated list of items to include
-     * 			i.e.  **\/*.xml, **\/*.properties
+     * @param includes A comma separated list of items to include i.e. **\/*.xml, **\/*.properties
      */
-    public void setIncludes ( String includes )
+    public void setIncludes( String includes )
     {
         this.includes = includes;
     }

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=949077&r1=949076&r2=949077&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 Fri May 28 02:49:44 2010
@@ -120,6 +120,7 @@ public class TestCopyMojo
         CopyMojo themojo = new CopyMojo();
 
         assertFalse( themojo.isStripVersion() );
+        assertFalse( themojo.isSkip() );
     }
 
     public void testCopyFile()
@@ -133,6 +134,26 @@ public class TestCopyMojo
 
         assertFilesExist( list, true );
     }
+    
+    public void testSkip()
+        throws IOException, MojoExecutionException
+    {
+        ArrayList list = stubFactory.getArtifactItems( stubFactory.getClassifiedArtifacts() );
+
+        mojo.setSkip( true );
+        mojo.setArtifactItems( list );
+
+        mojo.execute();
+        Iterator iter = list.iterator();
+        while ( iter.hasNext() )
+        {
+            //these will be null because no processing has occured only when everything is skipped
+            ArtifactItem item = (ArtifactItem) iter.next();
+            assertEquals( null, item.getOutputDirectory() );
+            assertEquals( null, item.getDestFileName() );
+        }
+
+    }
 
     public void testCopyFileNoOverwrite()
         throws IOException, MojoExecutionException

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java?rev=949077&r1=949076&r2=949077&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java Fri May 28 02:49:44 2010
@@ -141,6 +141,19 @@ public class TestUnpackMojo
 
         assertMarkerFiles( list, true );
     }
+    
+    public void testSkip()
+        throws IOException, MojoExecutionException
+    {
+        ArrayList list = stubFactory.getArtifactItems( stubFactory.getClassifiedArtifacts() );
+
+        mojo.setSkip( true );
+        mojo.setArtifactItems( list );
+
+        mojo.execute();
+
+        assertMarkerFiles( list, false );
+    }
 
     public void testUnpackToLocation()
         throws IOException, MojoExecutionException