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 2007/07/20 02:59:15 UTC

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

Author: brianf
Date: Thu Jul 19 17:59:13 2007
New Revision: 557831

URL: http://svn.apache.org/viewvc?view=rev&rev=557831
Log:
applied patches from Damian Bradicich for MDEP-47

Added:
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/markers/UnpackFileMarkerHandler.java
      - copied unchanged from r557829, maven/plugins/branches/maven-dependency-plugin-MDEP-47/src/main/java/org/apache/maven/plugin/dependency/utils/markers/UnpackFileMarkerHandler.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestIncludeExcludeUnpackDependenciesMojo.java
      - copied unchanged from r557829, maven/plugins/branches/maven-dependency-plugin-MDEP-47/src/test/java/org/apache/maven/plugin/dependency/TestIncludeExcludeUnpackDependenciesMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestIncludeExcludeUnpackMojo.java
      - copied unchanged from r557829, maven/plugins/branches/maven-dependency-plugin-MDEP-47/src/test/java/org/apache/maven/plugin/dependency/TestIncludeExcludeUnpackMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/testUtils/stubs/StubUnpackFileMarkerHandler.java
      - copied unchanged from r557829, maven/plugins/branches/maven-dependency-plugin-MDEP-47/src/test/java/org/apache/maven/plugin/dependency/testUtils/stubs/StubUnpackFileMarkerHandler.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/utils/markers/TestUnpackMarkerFileHandler.java
      - copied unchanged from r557829, maven/plugins/branches/maven-dependency-plugin-MDEP-47/src/test/java/org/apache/maven/plugin/dependency/utils/markers/TestUnpackMarkerFileHandler.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/unpack-dependencies-test/test.zip
      - copied unchanged from r557829, maven/plugins/branches/maven-dependency-plugin-MDEP-47/src/test/resources/unit/unpack-dependencies-test/test.zip
Modified:
    maven/plugins/trunk/maven-dependency-plugin/pom.xml
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/UnpackDependenciesMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/ArtifactItem.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/site/apt/examples/unpacking-artifacts.apt
    maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/unpacking-project-dependencies.apt
    maven/plugins/trunk/maven-dependency-plugin/src/site/apt/usage.apt
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/fromConfiguration/TestUnpackMojo.java

Modified: maven/plugins/trunk/maven-dependency-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/pom.xml?view=diff&rev=557831&r1=557830&r2=557831
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-dependency-plugin/pom.xml Thu Jul 19 17:59:13 2007
@@ -77,6 +77,29 @@
 	<build>
 		<plugins>
 			<plugin>
+				<artifactId>maven-enforcer-plugin</artifactId>
+				<version>1.0-alpha-3</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>enforce</goal>
+						</goals>
+						<id>ensure-no-container-api</id>
+						<configuration>
+							<rules>
+								<bannedDependencies>
+									<excludes>
+										<exclude>org.codehaus.plexus:plexus-component-api</exclude>
+									</excludes>
+									<message>The new containers are not supported. You probably added a dependency that is missing the exclusions.</message>
+								</bannedDependencies>
+							</rules>  
+							<fail>true</fail>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
 				<groupId>org.codehaus.mojo</groupId>
 				<artifactId>cobertura-maven-plugin</artifactId>
 				<version>2.0</version>
@@ -145,17 +168,17 @@
 			<artifactId>plexus-archiver</artifactId>
 			<version>1.0-alpha-9-SNAPSHOT</version>
 			<exclusions>
-              <exclusion>
-                 <groupId>org.codehaus.plexus</groupId>
-                 <artifactId>plexus-container-default</artifactId>
-              </exclusion>
-              <exclusion>
-                 <groupId>org.codehaus.plexus</groupId>
-                 <artifactId>plexus-component-api</artifactId>
-              </exclusion>			  
-            </exclusions>
+				<exclusion>
+					<groupId>org.codehaus.plexus</groupId>
+					<artifactId>plexus-container-default</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>org.codehaus.plexus</groupId>
+					<artifactId>plexus-component-api</artifactId>
+				</exclusion>			  
+			</exclusions>
 		</dependency>
-<!--		<dependency>
+		<!--		<dependency>
 			<groupId>org.codehaus.plexus</groupId>
 			<artifactId>plexus-component-api</artifactId>
 			<version>1.0-alpha-9</version>
@@ -182,25 +205,40 @@
 			<version>1.0-alpha-9-stable-1</version>
 		</dependency>
 		<dependency>
-		    <groupId>org.apache.maven.shared</groupId>
-		    <artifactId>maven-dependency-analyzer</artifactId>
-		    <version>1.0-alpha-3-SNAPSHOT</version>
+			<groupId>org.apache.maven.shared</groupId>
+			<artifactId>maven-dependency-analyzer</artifactId>
+			<version>1.0-alpha-3-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.maven.shared</groupId>
 			<artifactId>maven-dependency-tree</artifactId>
 			<version>1.0</version>
 		</dependency>
+		<dependency>
+			<groupId>org.codehaus.plexus</groupId>
+			<artifactId>plexus-io</artifactId>
+			<version>1.0-alpha-1</version>
+			<exclusions>
+				<exclusion>
+					<groupId>org.codehaus.plexus</groupId>
+					<artifactId>plexus-container-default</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>org.codehaus.plexus</groupId>
+					<artifactId>plexus-component-api</artifactId>
+				</exclusion>			  
+			</exclusions>
+		</dependency>
 	</dependencies>
 
-  <!-- TODO: remove when plexus-archiver is released -->
-  <repositories>
-    <repository>
-      <id>codehaus.snapshots</id>
-      <url>http://snapshots.repository.codehaus.org/</url>
-      <releases>
-        <enabled>false</enabled>
-      </releases>
-    </repository>
-  </repositories>
+	<!-- TODO: remove when plexus-archiver is released -->
+	<repositories>
+		<repository>
+			<id>codehaus.snapshots</id>
+			<url>http://snapshots.repository.codehaus.org/</url>
+			<releases>
+				<enabled>false</enabled>
+			</releases>
+		</repository>
+	</repositories>
 </project>

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java?view=diff&rev=557831&r1=557830&r2=557831
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java Thu Jul 19 17:59:13 2007
@@ -34,12 +34,15 @@
 import org.codehaus.plexus.archiver.UnArchiver;
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
 import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
+import org.codehaus.plexus.components.io.fileselectors.IncludeExcludeFileSelector;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.ReflectionUtils;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
  * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- * @version $Id$
+ * @version $Id: AbstractDependencyMojo.java 552528
+ *          2007-07-02 16:12:47Z markh $
  */
 public abstract class AbstractDependencyMojo
     extends AbstractMojo
@@ -129,7 +132,8 @@
      * 
      * @optional
      * @since 2.0
-     * @parameter expression="${silent}" default-value="false"
+     * @parameter expression="${silent}"
+     *            default-value="false"
      */
     public boolean silent;
 
@@ -148,7 +152,7 @@
     /**
      * @return Returns the log.
      */
-    public Log getLog()
+    public Log getLog ()
     {
         if ( silent )
         {
@@ -165,7 +169,7 @@
     /**
      * @return Returns the archiverManager.
      */
-    public ArchiverManager getArchiverManager()
+    public ArchiverManager getArchiverManager ()
     {
         return this.archiverManager;
     }
@@ -173,15 +177,13 @@
     /**
      * Does the actual copy of the file and logging.
      * 
-     * @param artifact
-     *            represents the file to copy.
-     * @param destFile
-     *            file name of destination file.
+     * @param artifact represents the file to copy.
+     * @param destFile file name of destination file.
      * 
-     * @throws MojoExecutionException
-     *             with a message if an error occurs.
+     * @throws MojoExecutionException with a message if an
+     *             error occurs.
      */
-    protected void copyFile( File artifact, File destFile )
+    protected void copyFile ( File artifact, File destFile )
         throws MojoExecutionException
     {
         Log theLog = this.getLog();
@@ -198,16 +200,25 @@
             throw new MojoExecutionException( "Error copying artifact from " + artifact + " to " + destFile, e );
         }
     }
+    
+    protected void unpack ( File file, File location )
+    	throws MojoExecutionException
+	{
+    	unpack( file, location, null, null);
+	}
 
     /**
      * Unpacks the archive file.
      * 
-     * @param file
-     *            File to be unpacked.
-     * @param location
-     *            Location where to put the unpacked files.
+     * @param file File to be unpacked.
+     * @param location Location where to put the unpacked
+     *            files.
+     * @param includes Comma separated list of file patterns to include
+     * 			  i.e.  **\/*.xml, **\/*.properties
+	 * @param excludes Comma separated list of file patterns to exclude
+     * 			  i.e.  **\/*.xml, **\/*.properties
      */
-    protected void unpack( File file, File location )
+    protected void unpack ( File file, File location, String includes, String excludes )
         throws MojoExecutionException
     {
 
@@ -223,6 +234,25 @@
 
             unArchiver.setDestDirectory( location );
 
+            if ( StringUtils.isNotEmpty( excludes ) || StringUtils.isNotEmpty( includes ) )
+            {
+                // Create the selectors that will filter
+                // based on include/exclude parameters
+                // MDEP-47
+                IncludeExcludeFileSelector[] selectors = new IncludeExcludeFileSelector[] { new IncludeExcludeFileSelector() };
+
+                if ( StringUtils.isNotEmpty( excludes ) )
+                {
+                    selectors[0].setExcludes( excludes.split( "," ) );
+                }
+
+                if ( StringUtils.isNotEmpty( includes ) )
+                {
+                    selectors[0].setIncludes( includes.split( "," ) );
+                }
+
+                unArchiver.setFileSelectors( selectors );
+            }
             if ( this.silent )
             {
                 silenceUnarchiver( unArchiver );
@@ -242,9 +272,10 @@
         }
     }
 
-    private void silenceUnarchiver( UnArchiver unArchiver )
+    private void silenceUnarchiver ( UnArchiver unArchiver )
     {
-        // dangerous but handle any errors. It's the only way to silence the
+        // dangerous but handle any errors. It's the only
+        // way to silence the
         // unArchiver.
         try
         {
@@ -256,23 +287,23 @@
         }
         catch ( Exception e )
         {
-            // was a nice try. Don't bother logging because the log is silent.
+            // was a nice try. Don't bother logging because
+            // the log is silent.
         }
     }
 
     /**
      * @return Returns the factory.
      */
-    public org.apache.maven.artifact.factory.ArtifactFactory getFactory()
+    public org.apache.maven.artifact.factory.ArtifactFactory getFactory ()
     {
         return this.factory;
     }
 
     /**
-     * @param factory
-     *            The factory to set.
+     * @param factory The factory to set.
      */
-    public void setFactory( org.apache.maven.artifact.factory.ArtifactFactory factory )
+    public void setFactory ( org.apache.maven.artifact.factory.ArtifactFactory factory )
     {
         this.factory = factory;
     }
@@ -280,7 +311,7 @@
     /**
      * @return Returns the project.
      */
-    public MavenProject getProject()
+    public MavenProject getProject ()
     {
         return this.project;
     }
@@ -288,16 +319,15 @@
     /**
      * @return Returns the local.
      */
-    public org.apache.maven.artifact.repository.ArtifactRepository getLocal()
+    public org.apache.maven.artifact.repository.ArtifactRepository getLocal ()
     {
         return this.local;
     }
 
     /**
-     * @param local
-     *            The local to set.
+     * @param local The local to set.
      */
-    public void setLocal( org.apache.maven.artifact.repository.ArtifactRepository local )
+    public void setLocal ( org.apache.maven.artifact.repository.ArtifactRepository local )
     {
         this.local = local;
     }
@@ -305,16 +335,15 @@
     /**
      * @return Returns the remoteRepos.
      */
-    public java.util.List getRemoteRepos()
+    public java.util.List getRemoteRepos ()
     {
         return this.remoteRepos;
     }
 
     /**
-     * @param remoteRepos
-     *            The remoteRepos to set.
+     * @param remoteRepos The remoteRepos to set.
      */
-    public void setRemoteRepos( java.util.List remoteRepos )
+    public void setRemoteRepos ( java.util.List remoteRepos )
     {
         this.remoteRepos = remoteRepos;
     }
@@ -322,25 +351,23 @@
     /**
      * @return Returns the resolver.
      */
-    public org.apache.maven.artifact.resolver.ArtifactResolver getResolver()
+    public org.apache.maven.artifact.resolver.ArtifactResolver getResolver ()
     {
         return this.resolver;
     }
 
     /**
-     * @param resolver
-     *            The resolver to set.
+     * @param resolver The resolver to set.
      */
-    public void setResolver( org.apache.maven.artifact.resolver.ArtifactResolver resolver )
+    public void setResolver ( org.apache.maven.artifact.resolver.ArtifactResolver resolver )
     {
         this.resolver = resolver;
     }
 
     /**
-     * @param archiverManager
-     *            The archiverManager to set.
+     * @param archiverManager The archiverManager to set.
      */
-    public void setArchiverManager( ArchiverManager archiverManager )
+    public void setArchiverManager ( ArchiverManager archiverManager )
     {
         this.archiverManager = archiverManager;
     }
@@ -348,16 +375,16 @@
     /**
      * @return Returns the artifactCollector.
      */
-    public ArtifactCollector getArtifactCollector()
+    public ArtifactCollector getArtifactCollector ()
     {
         return this.artifactCollector;
     }
 
     /**
-     * @param theArtifactCollector
-     *            The artifactCollector to set.
+     * @param theArtifactCollector The artifactCollector to
+     *            set.
      */
-    public void setArtifactCollector( ArtifactCollector theArtifactCollector )
+    public void setArtifactCollector ( ArtifactCollector theArtifactCollector )
     {
         this.artifactCollector = theArtifactCollector;
     }
@@ -365,16 +392,16 @@
     /**
      * @return Returns the artifactMetadataSource.
      */
-    public ArtifactMetadataSource getArtifactMetadataSource()
+    public ArtifactMetadataSource getArtifactMetadataSource ()
     {
         return this.artifactMetadataSource;
     }
 
     /**
-     * @param theArtifactMetadataSource
-     *            The artifactMetadataSource to set.
+     * @param theArtifactMetadataSource The
+     *            artifactMetadataSource to set.
      */
-    public void setArtifactMetadataSource( ArtifactMetadataSource theArtifactMetadataSource )
+    public void setArtifactMetadataSource ( ArtifactMetadataSource theArtifactMetadataSource )
     {
         this.artifactMetadataSource = theArtifactMetadataSource;
     }

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/UnpackDependenciesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/UnpackDependenciesMojo.java?view=diff&rev=557831&r1=557830&r2=557831
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/UnpackDependenciesMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/UnpackDependenciesMojo.java Thu Jul 19 17:59:13 2007
@@ -45,8 +45,23 @@
 public class UnpackDependenciesMojo
     extends AbstractFromDependenciesMojo
 {
+	/**
+     * A comma separated list of file patterns to include when unpacking the
+     * artifact.  i.e.  **\/*.xml,**\/*.properties
+     * 
+     * @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
+     * 
+     * @parameter expression="${mdep.unpack.excludes}"
+     */
+    private String excludes;
+    
+    /**
      * Main entry into mojo. This method gets the dependencies and iterates
      * through each one passing it to DependencyUtil.unpackFile().
      * 
@@ -70,7 +85,7 @@
             destDir = DependencyUtil.getFormattedOutputDirectory( useSubDirectoryPerType, useSubDirectoryPerArtifact,
                                                                   useRepositoryLayout, stripVersion, outputDirectory,
                                                                   artifact );
-            unpack( artifact.getFile(), destDir );
+            unpack( artifact.getFile(), destDir, getIncludes(), getExcludes() );
             DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler( artifact, this.markersDirectory );
             handler.setMarker();
         }
@@ -87,5 +102,41 @@
     {
         return new MarkerFileFilter( this.overWriteReleases, this.overWriteSnapshots, this.overWriteIfNewer,
                                      new DefaultFileMarkerHandler( this.markersDirectory ) );
+    }
+    
+    /**
+     * @return Returns a comma separated list of excluded items
+     */
+    public String getExcludes ()
+    {
+        return this.excludes;
+    }
+    
+    /**
+     * @param excludes 
+     * 			A comma separated list of items to exclude 
+     * 			i.e.  **\/*.xml, **\/*.properties
+     */
+    public void setExcludes ( String excludes )
+    {
+        this.excludes = excludes;
+    }
+    
+    /**
+     * @return Returns a comma seperated list of included items
+     */
+    public String getIncludes()
+    {
+    	return this.includes;
+    }
+
+    /**
+     * @param includes
+     * 			A comma seperated list of items to inmclude 
+     * 			i.e.  **\/*.xml, **\/*.properties
+     */
+    public void setIncludes ( String includes )
+    {
+        this.includes = includes;
     }
 }

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/ArtifactItem.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/ArtifactItem.java?view=diff&rev=557831&r1=557830&r2=557831
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/ArtifactItem.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/ArtifactItem.java Thu Jul 19 17:59:13 2007
@@ -100,6 +100,18 @@
      * Artifact Item
      */
     private Artifact artifact;
+    
+    /**
+     * A comma separated list of file patterns to include when unpacking the
+     * artifact.
+     */
+    private String includes;
+
+    /**
+     * A comma separated list of file patterns to exclude when unpacking the
+     * artifact.
+     */
+    private String excludes;
 
     public ArtifactItem()
     {
@@ -309,5 +321,41 @@
     public void setArtifact( Artifact artifact )
     {
         this.artifact = artifact;
+    }
+    
+    /**
+     * @return Returns a comma separated list of excluded items
+     */
+    public String getExcludes ()
+    {
+        return this.excludes;
+    }
+    
+    /**
+     * @param excludes 
+     * 			A comma seperated list of items to exclude 
+     * 			i.e.  **\/*.xml, **\/*.properties
+     */
+    public void setExcludes ( String excludes )
+    {
+        this.excludes = excludes;
+    }
+    
+    /**
+     * @return Returns a comma seperated list of included items
+     */
+    public String getIncludes()
+    {
+    	return this.includes;
+    }
+
+    /**
+     * @param includes
+     * 			A comma seperated list of items to inmclude 
+     * 			i.e.  **\/*.xml, **\/*.properties
+     */
+    public void setIncludes ( String includes )
+    {
+        this.includes = includes;
     }
 }

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?view=diff&rev=557831&r1=557830&r2=557831
==============================================================================
--- 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 Thu Jul 19 17:59:13 2007
@@ -28,10 +28,11 @@
 import org.apache.maven.plugin.dependency.utils.DependencyUtil;
 import org.apache.maven.plugin.dependency.utils.filters.ArtifactItemFilter;
 import org.apache.maven.plugin.dependency.utils.filters.MarkerFileFilter;
-import org.apache.maven.plugin.dependency.utils.markers.DefaultFileMarkerHandler;
 import org.apache.maven.plugin.dependency.utils.markers.MarkerHandler;
+import org.apache.maven.plugin.dependency.utils.markers.UnpackFileMarkerHandler;
 import org.apache.maven.plugin.logging.Log;
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
  * Goal that retrieves a list of artifacts from the repository and unpacks them
@@ -53,6 +54,22 @@
      * @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
+     *  
+     * @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
+     * 
+     * @parameter expression="${mdep.unpack.excludes}"
+     */
+    private String excludes;
 
     /**
      * Main entry into mojo. This method gets the ArtifactItems and iterates
@@ -100,22 +117,40 @@
     private void unpackArtifact( ArtifactItem artifactItem )
         throws MojoExecutionException
     {
-        Artifact artifact = artifactItem.getArtifact();
-
-        MarkerHandler handler = new DefaultFileMarkerHandler( artifact, this.markersDirectory );
-
-        unpack( artifact.getFile(), artifactItem.getOutputDirectory() );
+        MarkerHandler handler = new UnpackFileMarkerHandler( artifactItem, this.markersDirectory );
+        
+        unpack( artifactItem.getArtifact().getFile(), artifactItem.getOutputDirectory(), artifactItem.getIncludes(), artifactItem.getExcludes() );
         handler.setMarker();
 
     }
 
     ArtifactItemFilter getMarkedArtifactFilter( ArtifactItem item )
     {
-        MarkerHandler handler = new DefaultFileMarkerHandler( item.getArtifact(), this.markersDirectory );
+        MarkerHandler handler = new UnpackFileMarkerHandler( item, this.markersDirectory );
 
         return new MarkerFileFilter( this.isOverWriteReleases(), this.isOverWriteSnapshots(),
                                      this.isOverWriteIfNewer(), handler );
     }
+    
+    protected ArrayList getProcessedArtifactItems(boolean removeVersion)
+    	throws MojoExecutionException 
+    {
+    	ArrayList items = super.getProcessedArtifactItems( removeVersion );
+    	Iterator iter = items.iterator();
+        while ( iter.hasNext() )
+        {
+            ArtifactItem artifactItem = (ArtifactItem) iter.next();
+            if ( StringUtils.isEmpty(artifactItem.getIncludes()) )
+            {
+                artifactItem.setIncludes( getIncludes() );
+            }
+            if ( StringUtils.isEmpty(artifactItem.getExcludes()) )
+            {
+                artifactItem.setExcludes( getExcludes() );
+            }
+        }
+    	return items;
+    }
 
     /**
      * @return Returns the markersDirectory.
@@ -132,5 +167,42 @@
     public void setMarkersDirectory( File theMarkersDirectory )
     {
         this.markersDirectory = theMarkersDirectory;
+    }
+    
+   
+    /**
+     * @return Returns a comma separated list of excluded items
+     */
+    public String getExcludes ()
+    {
+        return this.excludes;
+    }
+    
+    /**
+     * @param excludes 
+     * 			A comma separated list of items to exclude 
+     * 			i.e.  **\/*.xml, **\/*.properties
+     */
+    public void setExcludes ( String excludes )
+    {
+        this.excludes = excludes;
+    }
+    
+    /**
+     * @return Returns a comma separated list of included items
+     */
+    public String getIncludes()
+    {
+    	return this.includes;
+    }
+
+    /**
+     * @param includes
+     * 			A comma separated list of items to include 
+     * 			i.e.  **\/*.xml, **\/*.properties
+     */
+    public void setIncludes ( String includes )
+    {
+        this.includes = includes;
     }
 }

Modified: maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/unpacking-artifacts.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/unpacking-artifacts.apt?view=diff&rev=557831&r1=557830&r2=557831
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/unpacking-artifacts.apt (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/unpacking-artifacts.apt Thu Jul 19 17:59:13 2007
@@ -56,9 +56,13 @@
                    <overWrite>false</overWrite>
                    <outputDirectory>${project.build.directory}/alternateLocation</outputDirectory>
                    <destFileName>optional-new-name.jar</destFileName>
+                   <includes>**/*.class,**/*.xml</includes>
+                   <excludes>**/*test.class</excludes>
                  </artifactItem>
                </artifactItems>
-               <outputDirectory>${project.build.directory}/wars</outputDirectory>
+               <includes>**/*.java</includes>
+               <excludes>**/*.properties</excludes>
+	           <outputDirectory>${project.build.directory}/wars</outputDirectory>
                <overWriteReleases>false</overWriteReleases>
                <overWriteSnapshots>true</overWriteSnapshots>
              </configuration>
@@ -103,6 +107,8 @@
               <overWrite>[ true or false ]</overWrite>
               <outputDirectory>[ output directory ]</outputDirectory>
               <destFileName>[ filename ]</destFileName>
+              <includes>[ comma seperated list of file filters ]</includes>
+              <excludes>[ comma seperated list of file filters ]</excludes>
             </artifactItem>
           </artifactItems>
           <!-- other configurations here -->
@@ -113,6 +119,8 @@
   [...]
 </project>
 +---+	
+
+
 
 
 

Modified: maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/unpacking-project-dependencies.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/unpacking-project-dependencies.apt?view=diff&rev=557831&r1=557830&r2=557831
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/unpacking-project-dependencies.apt (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/unpacking-project-dependencies.apt Thu Jul 19 17:59:13 2007
@@ -48,6 +48,8 @@
               <goal>unpack-dependencies</goal>
             </goals>
             <configuration>
+              <includes>**/*.class</includes>
+              <excludes>**/*.properties</excludes>
               <outputDirectory>${project.build.directory}/alternateLocation</outputDirectory>
               <overWriteReleases>false</overWriteReleases>
               <overWriteSnapshots>true</overWriteSnapshots>
@@ -60,5 +62,7 @@
   [...]
 </project>
 +---+
+
+
 
 

Modified: maven/plugins/trunk/maven-dependency-plugin/src/site/apt/usage.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/site/apt/usage.apt?view=diff&rev=557831&r1=557830&r2=557831
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/site/apt/usage.apt (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/site/apt/usage.apt Thu Jul 19 17:59:13 2007
@@ -204,6 +204,9 @@
    specified location. Multiple artifacts can be defined in a single execution.
    A default outputDirectory is specified but can be overriden for each
    ArtifactItem by setting the optional outputDirectory field. 
+   
+   A single artifact can be unpacked multiple times if different include/exclude parameters
+   are defined for each artifactItem
 
    See the {{#Overwrite Rules}} section for rules about how overwriting is handled.
 
@@ -266,6 +269,8 @@
               <overWrite>[ true or false ]</overWrite>
               <outputDirectory>[ output directory ]</outputDirectory>
               <destFileName>[ filename ]</destFileName>
+              <includes>[ comma seperated list of file filters ]</includes>
+              <excludes>[ comma seperated list of file filters ]</excludes>
             </artifactItem>
           </artifactItems>
           <!-- other configurations here -->
@@ -309,6 +314,8 @@
    resolve artifacts with the classifer and type. For example:
    <<<mvn dependency:unpack-dependencies -Dclassifer=sources>>> will try to find
    the sources for all dependencies and unpack them.
+   
+   Filters can be applied to include or exclude certain file or filesets as necessary
    
       	Also included is the ability to include or exclude by type (war, jar etc), scope (runtime, test, etc), classifier (jdk14, sources, etc), groupId, artifactId, or a combination of them. 
       	

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?view=diff&rev=557831&r1=557830&r2=557831
==============================================================================
--- 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 Thu Jul 19 17:59:13 2007
@@ -32,7 +32,7 @@
 import org.apache.maven.plugin.dependency.AbstractDependencyMojoTestCase;
 import org.apache.maven.plugin.dependency.testUtils.DependencyArtifactStubFactory;
 import org.apache.maven.plugin.dependency.testUtils.DependencyTestUtils;
-import org.apache.maven.plugin.dependency.utils.markers.DefaultFileMarkerHandler;
+import org.apache.maven.plugin.dependency.utils.markers.UnpackFileMarkerHandler;
 import org.apache.maven.plugin.testing.stubs.StubArtifactCollector;
 import org.apache.maven.plugin.testing.stubs.StubArtifactRepository;
 import org.apache.maven.plugin.testing.stubs.StubArtifactResolver;
@@ -119,7 +119,7 @@
 
     public void assertMarkerFile( boolean val, ArtifactItem item )
     {
-        DefaultFileMarkerHandler handle = new DefaultFileMarkerHandler( item.getArtifact(), mojo.getMarkersDirectory() );
+        UnpackFileMarkerHandler handle = new UnpackFileMarkerHandler( item, mojo.getMarkersDirectory() );
         try
         {
             assertEquals( val, handle.isMarkerSet() );