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/02/23 03:24:42 UTC

svn commit: r510766 - 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/a...

Author: brianf
Date: Thu Feb 22 18:24:41 2007
New Revision: 510766

URL: http://svn.apache.org/viewvc?view=rev&rev=510766
Log:
MDEP-65 - added repository layout parameter
Patch provided by Alexis Midon

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/CopyDependenciesMojo.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/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/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/TestCopyDependenciesMojo2.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo.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?view=diff&rev=510766&r1=510765&r2=510766
==============================================================================
--- 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 Thu Feb 22 18:24:41 2007
@@ -36,7 +36,7 @@
      * Strip artifact version during copy
      * 
      * @optional
-     * @parameter expression="${stripVersion}" default-value="false"
+     * @parameter expression="${mdep.stripVersion}" default-value="false"
      * @parameter
      */
     protected boolean stripVersion = false;
@@ -52,21 +52,30 @@
     protected File outputDirectory;
 
     /**
+     * Place each artifact in the same directory layout as a default repository.
+     * <br/>example: /outputDirectory/junit/junit/3.8.1/junit-3.8.1.jar
+     * @since 2.0-alpha-2
+     * @parameter expression="${mdep.useRepositoryLayout}" default-value="false"
+     * @optional
+     */
+    protected boolean useRepositoryLayout;
+
+    /**
      * Place each type of file in a separate subdirectory. (example
      * /outputDirectory/jars /outputDirectory/wars etc)
      * 
      * @since 2.0
-     * @parameter expression="${useSubDirectoryPerType}" default-value="false"
+     * @parameter expression="${mdep.useSubDirectoryPerType}" default-value="false"
      * @optional
      */
     protected boolean useSubDirectoryPerType;
 
     /**
      * Place each file in a separate subdirectory. (example
-     * /outputDirectory/junit-junit-3.8.1)
+     * /outputDirectory/junit-3.8.1-jar)
      * 
      * @since 2.0
-     * @parameter expression="${useSubDirectoryPerArtifact}"
+     * @parameter expression="${mdep.useSubDirectoryPerArtifact}"
      *            default-value="false"
      * @optional
      */
@@ -153,4 +162,22 @@
         this.stripVersion = stripVersion;
     }
 
+    /**
+     * 
+     * @return true, if dependencies must be planted in a repository layout
+     */
+    public boolean isUseRepositoryLayout()
+    {
+        return useRepositoryLayout;
+    }
+
+    /**
+     * 
+     * @param useRepositoryLayout -
+     *            true if dependencies must be planted in a repository layout
+     */
+    public void setUseRepositoryLayout( boolean useRepositoryLayout )
+    {
+        this.useRepositoryLayout = useRepositoryLayout;
+    }
 }

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?view=diff&rev=510766&r1=510765&r2=510766
==============================================================================
--- 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 Thu Feb 22 18:24:41 2007
@@ -96,9 +96,10 @@
 
         String destFileName = DependencyUtil.getFormattedFileName( artifact, removeVersion );
 
-        File destDir = DependencyUtil.getFormattedOutputDirectory( this.useSubDirectoryPerType,
-                                                                   this.useSubDirectoryPerArtifact, this.stripVersion,
-                                                                   this.outputDirectory, artifact );
+        File destDir;
+        destDir = DependencyUtil.getFormattedOutputDirectory( useSubDirectoryPerType, useSubDirectoryPerArtifact,
+                                                              useRepositoryLayout, stripVersion, outputDirectory,
+                                                              artifact );
         File destFile = new File( destDir, destFileName );
 
         copyFile( artifact.getFile(), destFile );
@@ -107,7 +108,7 @@
     protected ArtifactsFilter getMarkedArtifactFilter()
     {
         return new DestFileFilter( this.overWriteReleases, this.overWriteSnapshots, this.overWriteIfNewer,
-                                   this.useSubDirectoryPerArtifact, this.useSubDirectoryPerType, this.stripVersion,
-                                   this.outputDirectory );
+                                   this.useSubDirectoryPerArtifact, this.useSubDirectoryPerType,
+                                   this.useRepositoryLayout, this.stripVersion, this.outputDirectory );
     }
 }

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=510766&r1=510765&r2=510766
==============================================================================
--- 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 Feb 22 18:24:41 2007
@@ -65,11 +65,10 @@
         for ( Iterator i = artifacts.iterator(); i.hasNext(); )
         {
             Artifact artifact = (Artifact) i.next();
-            File destDir = DependencyUtil.getFormattedOutputDirectory( this.useSubDirectoryPerType,
-                                                                       this.useSubDirectoryPerArtifact,
-                                                                       this.stripVersion, this.outputDirectory,
-                                                                       artifact );
-
+            File destDir;
+            destDir = DependencyUtil.getFormattedOutputDirectory( useSubDirectoryPerType, useSubDirectoryPerArtifact,
+                                                                  useRepositoryLayout, stripVersion, outputDirectory,
+                                                                  artifact );
             unpack( artifact.getFile(), destDir );
             DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler( artifact, this.markersDirectory );
             handler.setMarker();

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?view=diff&rev=510766&r1=510765&r2=510766
==============================================================================
--- 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 Thu Feb 22 18:24:41 2007
@@ -23,18 +23,14 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
-import org.apache.maven.artifact.resolver.ResolutionNode;
 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.model.Dependency;
@@ -72,7 +68,7 @@
      * 
      * @optional
      * @since 1.0
-     * @parameter expression="${overWriteReleases}" default-value="false"
+     * @parameter expression="${mdep.overWriteReleases}" default-value="false"
      */
     private boolean overWriteReleases;
 
@@ -81,7 +77,7 @@
      * 
      * @optional
      * @since 1.0
-     * @parameter expression="${overWriteSnapshots}" default-value="false"
+     * @parameter expression="${mdep.overWriteSnapshots}" default-value="false"
      */
     private boolean overWriteSnapshots;
 
@@ -90,7 +86,7 @@
      * 
      * @optional
      * @since 2.0
-     * @parameter expression="${overIfNewer}" default-value="true"
+     * @parameter expression="${mdep.overIfNewer}" default-value="true"
      */
     private boolean overWriteIfNewer;
 
@@ -199,7 +195,7 @@
     {
         Artifact artifact;
 
-        Map managedVersions = createManagedVersionMap( factory, project.getId(), project.getDependencyManagement() );
+  //      Map managedVersions = createManagedVersionMap( factory, project.getId(), project.getDependencyManagement() );
         VersionRange vr;
         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?view=diff&rev=510766&r1=510765&r2=510766
==============================================================================
--- 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 Thu Feb 22 18:24:41 2007
@@ -43,7 +43,7 @@
     /**
      * Strip artifact version during copy
      * 
-     * @parameter expression="${stripVersion}" default-value="false"
+     * @parameter expression="${mdep.stripVersion}" default-value="false"
      * @parameter
      */
     private boolean stripVersion = false;
@@ -101,7 +101,7 @@
     protected ArtifactItemFilter getMarkedArtifactFilter( ArtifactItem item )
     {
         ArtifactItemFilter destinationNameOverrideFilter = new DestFileFilter( this.isOverWriteReleases(), this
-            .isOverWriteSnapshots(), this.isOverWriteIfNewer(), false, false, this.stripVersion, item
+            .isOverWriteSnapshots(), this.isOverWriteIfNewer(), false, false, false, this.stripVersion, item
             .getOutputDirectory() );
         return destinationNameOverrideFilter;
     }

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?view=diff&rev=510766&r1=510765&r2=510766
==============================================================================
--- 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 Thu Feb 22 18:24:41 2007
@@ -86,8 +86,13 @@
      * 
      * @param useSubdirsPerType
      *            if a new sub directory should be used for each type.
-     * @param useSubdirsPerArtifact
+     * @param useSubdirPerArtifact
      *            if a new sub directory should be used for each artifact.
+     * @param useRepositoryLayout
+     *            if dependendies must be moved into a Maven repository layout, if
+     *            set, other settings will be ignored.
+     * @param removeVersion
+     *            if the version must not be mentioned in the filename
      * @param outputDirectory
      *            base outputDirectory.
      * @param artifact
@@ -96,72 +101,64 @@
      * @return a formatted File object to use for output.
      */
     public static File getFormattedOutputDirectory( boolean useSubdirsPerType, boolean useSubdirPerArtifact,
-                                                   boolean removeVersion, File outputDirectory, Artifact artifact )
+                                                   boolean useRepositoryLayout, boolean removeVersion,
+                                                   File outputDirectory, Artifact artifact )
     {
-        File result = null;
-        String artifactString = getDependencyId(artifact,removeVersion);
-
-        
-        if ( !useSubdirsPerType )
+        StringBuffer sb = new StringBuffer( 128 );
+        if ( useRepositoryLayout )
         {
-            if ( useSubdirPerArtifact )
-            {
-
-                result = new File( outputDirectory.getAbsolutePath() + File.separatorChar + artifactString
-                    + File.separatorChar );
-            }
-            else
-            {
-                result = outputDirectory;
-            }
+            // group id
+            sb.append( artifact.getGroupId().replace( '.', File.separatorChar ) ).append( File.separatorChar );
+            // artifact id
+            sb.append( artifact.getArtifactId() ).append( File.separatorChar );
+            // version
+            sb.append( artifact.getVersion() ).append( File.separatorChar );
         }
         else
         {
-            if ( useSubdirPerArtifact )
+            if ( useSubdirsPerType )
             {
-                result = new File( outputDirectory.getAbsolutePath() + File.separatorChar + artifact.getType() + "s"
-                    + File.separatorChar + artifactString + File.separatorChar );
+                sb.append( artifact.getType() ).append( "s" ).append( File.separatorChar );
             }
-            else
+            if ( useSubdirPerArtifact )
             {
-                result = new File( outputDirectory.getAbsolutePath() + File.separatorChar + artifact.getType() + "s"
-                    + File.separatorChar );
+                String artifactString = getDependencyId( artifact, removeVersion );
+                sb.append( artifactString ).append( File.separatorChar );
             }
         }
-
-        return result;
-
+        return new File( outputDirectory, sb.toString() );
     }
-    
-    private static String getDependencyId(Artifact artifact,boolean removeVersion)
+
+    private static String getDependencyId( Artifact artifact, boolean removeVersion )
     {
         StringBuffer sb = new StringBuffer();
-        
+
         sb.append( artifact.getArtifactId() );
-        
-        if (StringUtils.isNotEmpty(artifact.getClassifier()))
+
+        if ( StringUtils.isNotEmpty( artifact.getClassifier() ) )
         {
-            sb.append("-");
-            sb.append(artifact.getClassifier());
+            sb.append( "-" );
+            sb.append( artifact.getClassifier() );
         }
-        
-        if (!removeVersion)
+
+        if ( !removeVersion )
         {
-            sb.append("-");
-            sb.append(artifact.getVersion());
-            sb.append("-");
+            sb.append( "-" );
+            sb.append( artifact.getVersion() );
+            sb.append( "-" );
             sb.append( artifact.getType() );
         }
         else
         {
-            //if the classifier and type are the same (sources), then don't repeat.
-            //avoids names like foo-sources-sources
-            if (!StringUtils.equals(artifact.getClassifier(),artifact.getType()))
+            // if the classifier and type are the same (sources), then don't
+            // repeat.
+            // avoids names like foo-sources-sources
+            if ( !StringUtils.equals( artifact.getClassifier(), artifact.getType() ) )
             {
-                sb.append("-");
+                sb.append( "-" );
                 sb.append( artifact.getType() );
             }
-        }     
+        }
         return sb.toString();
     }
 }

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?view=diff&rev=510766&r1=510765&r2=510766
==============================================================================
--- 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 Thu Feb 22 18:24:41 2007
@@ -54,6 +54,8 @@
 
     boolean useSubDirectoryPerType;
 
+    boolean useRepositoryLayout;
+
     boolean removeVersion;
 
     File outputFileDirectory;
@@ -70,14 +72,15 @@
     }
 
     public DestFileFilter( boolean overWriteReleases, boolean overWriteSnapshots, boolean overWriteIfNewer,
-                          boolean useSubDirectoryPerArtifact, boolean useSubDirectoryPerType, boolean removeVersion,
-                          File outputFileDirectory )
+                          boolean useSubDirectoryPerArtifact, boolean useSubDirectoryPerType,
+                          boolean useRepositoryLayout, boolean removeVersion, File outputFileDirectory )
     {
         this.overWriteReleases = overWriteReleases;
         this.overWriteSnapshots = overWriteSnapshots;
         this.overWriteIfNewer = overWriteIfNewer;
         this.useSubDirectoryPerArtifact = useSubDirectoryPerArtifact;
         this.useSubDirectoryPerType = useSubDirectoryPerType;
+        this.useRepositoryLayout = useRepositoryLayout;
         this.removeVersion = removeVersion;
         this.outputFileDirectory = outputFileDirectory;
     }
@@ -225,6 +228,25 @@
         this.useSubDirectoryPerType = useSubDirectoryPerType;
     }
 
+    /**
+     * 
+     * @return Returns the useRepositoryLayout
+     */
+    public boolean isUseRepositoryLayout()
+    {
+        return useRepositoryLayout;
+    }
+
+    /**
+     * 
+     * @param useRepositoryLayout
+     *            the useRepositoryLayout to set
+     */
+    public void setUseRepositoryLayout( boolean useRepositoryLayout )
+    {
+        this.useRepositoryLayout = useRepositoryLayout;
+    }
+
     public boolean okToProcess( ArtifactItem item )
         throws MojoExecutionException
     {
@@ -241,10 +263,9 @@
         File destFolder = item.getOutputDirectory();
         if ( destFolder == null )
         {
-            destFolder = DependencyUtil.getFormattedOutputDirectory( this.useSubDirectoryPerType,
-                                                                     this.useSubDirectoryPerArtifact,
-                                                                     this.removeVersion, this.outputFileDirectory,
-                                                                     artifact );
+            destFolder = DependencyUtil.getFormattedOutputDirectory( useSubDirectoryPerType,
+                                                                     useSubDirectoryPerArtifact, useRepositoryLayout,
+                                                                     removeVersion, this.outputFileDirectory, artifact );
         }
 
         File destFile = null;

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?view=diff&rev=510766&r1=510765&r2=510766
==============================================================================
--- 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 Thu Feb 22 18:24:41 2007
@@ -321,7 +321,7 @@
         {
             Artifact artifact = (Artifact) iter.next();
             String fileName = DependencyUtil.getFormattedFileName( artifact, false );
-            File folder = DependencyUtil.getFormattedOutputDirectory( true, false, false, mojo.outputDirectory,
+            File folder = DependencyUtil.getFormattedOutputDirectory( true, false, false, false, mojo.outputDirectory,
                                                                       artifact );
             File file = new File( folder, fileName );
             assertTrue( file.exists() );
@@ -339,7 +339,7 @@
         {
             Artifact artifact = (Artifact) iter.next();
             String fileName = DependencyUtil.getFormattedFileName( artifact, false );
-            File folder = DependencyUtil.getFormattedOutputDirectory( false, true, false, mojo.outputDirectory,
+            File folder = DependencyUtil.getFormattedOutputDirectory( false, true, false, false, mojo.outputDirectory,
                                                                       artifact );
             File file = new File( folder, fileName );
             assertTrue( file.exists() );
@@ -360,8 +360,26 @@
         {
             Artifact artifact = (Artifact) iter.next();
             String fileName = DependencyUtil.getFormattedFileName( artifact, false );
-            File folder = DependencyUtil
-                .getFormattedOutputDirectory( true, true, false, mojo.outputDirectory, artifact );
+            File folder = DependencyUtil.getFormattedOutputDirectory( true, true, false, false, mojo.outputDirectory,
+                                                                      artifact );
+            File file = new File( folder, fileName );
+            assertTrue( file.exists() );
+        }
+    }
+
+    public void testCopyDependenciesMojoRepositoryLayout()
+        throws Exception
+    {
+        mojo.useRepositoryLayout = true;
+        mojo.execute();
+
+        Iterator iter = mojo.project.getArtifacts().iterator();
+        while ( iter.hasNext() )
+        {
+            Artifact artifact = (Artifact) iter.next();
+            String fileName = DependencyUtil.getFormattedFileName( artifact, false );
+            File folder = DependencyUtil.getFormattedOutputDirectory( false, true, mojo.useRepositoryLayout, false,
+                                                                      mojo.outputDirectory, artifact );
             File file = new File( folder, fileName );
             assertTrue( file.exists() );
         }
@@ -379,8 +397,8 @@
         {
             Artifact artifact = (Artifact) iter.next();
             String fileName = DependencyUtil.getFormattedFileName( artifact, true );
-            File folder = DependencyUtil
-                .getFormattedOutputDirectory( false, true, true, mojo.outputDirectory, artifact );
+            File folder = DependencyUtil.getFormattedOutputDirectory( false, true, false, true, mojo.outputDirectory,
+                                                                      artifact );
             File file = new File( folder, fileName );
             assertTrue( file.exists() );
         }
@@ -401,7 +419,8 @@
         {
             Artifact artifact = (Artifact) iter.next();
             String fileName = DependencyUtil.getFormattedFileName( artifact, true );
-            File folder = DependencyUtil.getFormattedOutputDirectory( true, true, true, mojo.outputDirectory, artifact );
+            File folder = DependencyUtil.getFormattedOutputDirectory( true, true, false, true, mojo.outputDirectory,
+                                                                      artifact );
             File file = new File( folder, fileName );
             assertTrue( file.exists() );
         }

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo2.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo2.java?view=diff&rev=510766&r1=510765&r2=510766
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo2.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestCopyDependenciesMojo2.java Thu Feb 22 18:24:41 2007
@@ -76,7 +76,6 @@
 
     }
 
-
     public void testCopyDependenciesMojoIncludeCompileScope()
         throws Exception
     {

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo.java?view=diff&rev=510766&r1=510765&r2=510766
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestUnpackDependenciesMojo.java Thu Feb 22 18:24:41 2007
@@ -86,7 +86,8 @@
     public void assertUnpacked( boolean val, Artifact artifact )
     {
         File folder = DependencyUtil.getFormattedOutputDirectory( mojo.useSubDirectoryPerType,
-                                                                  mojo.useSubDirectoryPerArtifact, mojo.stripVersion,
+                                                                  mojo.useSubDirectoryPerArtifact,
+                                                                  mojo.useRepositoryLayout, mojo.stripVersion,
                                                                   mojo.outputDirectory, artifact );
 
         File destFile = new File( folder, ArtifactStubFactory.getUnpackableFileName( artifact ) );
@@ -308,39 +309,39 @@
             assertUnpacked( artifact );
         }
     }
-    
+
     public void testUnpackDependenciesMojoSubPerArtifactRemoveVersion()
-    throws Exception
-{
-    mojo.useSubDirectoryPerArtifact = true;
-    mojo.stripVersion = true;
-    mojo.execute();
-
-    Iterator iter = mojo.project.getArtifacts().iterator();
-    while ( iter.hasNext() )
-    {
-        Artifact artifact = (Artifact) iter.next();
-        assertUnpacked( artifact );
-    }
-}
-
-public void testUnpackDependenciesMojoSubPerArtifactAndTypeRemoveVersion()
-    throws Exception
-{
-    mojo.project.setArtifacts( stubFactory.getTypedArchiveArtifacts() );
-    mojo.project.setDependencyArtifacts( new HashSet() );
-    mojo.useSubDirectoryPerArtifact = true;
-    mojo.useSubDirectoryPerType = true;
-    mojo.stripVersion = true;
-    mojo.execute();
+        throws Exception
+    {
+        mojo.useSubDirectoryPerArtifact = true;
+        mojo.stripVersion = true;
+        mojo.execute();
+
+        Iterator iter = mojo.project.getArtifacts().iterator();
+        while ( iter.hasNext() )
+        {
+            Artifact artifact = (Artifact) iter.next();
+            assertUnpacked( artifact );
+        }
+    }
 
-    Iterator iter = mojo.project.getArtifacts().iterator();
-    while ( iter.hasNext() )
+    public void testUnpackDependenciesMojoSubPerArtifactAndTypeRemoveVersion()
+        throws Exception
     {
-        Artifact artifact = (Artifact) iter.next();
-        assertUnpacked( artifact );
+        mojo.project.setArtifacts( stubFactory.getTypedArchiveArtifacts() );
+        mojo.project.setDependencyArtifacts( new HashSet() );
+        mojo.useSubDirectoryPerArtifact = true;
+        mojo.useSubDirectoryPerType = true;
+        mojo.stripVersion = true;
+        mojo.execute();
+
+        Iterator iter = mojo.project.getArtifacts().iterator();
+        while ( iter.hasNext() )
+        {
+            Artifact artifact = (Artifact) iter.next();
+            assertUnpacked( artifact );
+        }
     }
-}
 
     public void testUnpackDependenciesMojoIncludeCompileScope()
         throws Exception
@@ -589,7 +590,8 @@
     public File getUnpackedFile( Artifact artifact )
     {
         File destDir = DependencyUtil.getFormattedOutputDirectory( mojo.isUseSubDirectoryPerType(), mojo
-            .isUseSubDirectoryPerArtifact(), mojo.stripVersion, mojo.getOutputDirectory(), artifact );
+            .isUseSubDirectoryPerArtifact(), mojo.useRepositoryLayout, mojo.stripVersion, mojo.getOutputDirectory(),
+                                                                   artifact );
         File unpacked = new File( destDir, ArtifactStubFactory.getUnpackableFileName( artifact ) );
         assertTrue( unpacked.exists() );
         return unpacked;

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?view=diff&rev=510766&r1=510765&r2=510766
==============================================================================
--- 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 Thu Feb 22 18:24:41 2007
@@ -53,7 +53,7 @@
     Artifact snap;
 
     Artifact release;
-    
+
     Artifact sources;
 
     protected void setUp()
@@ -74,7 +74,7 @@
         ah = new DefaultArtifactHandlerStub( "war", null );
         vr = VersionRange.createFromVersion( "1.1-SNAPSHOT" );
         sources = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "sources", "sources", ah, false );
-       
+
         // pick random output location
         Random a = new Random();
         outputFolder = new File( "target/copy" + a.nextLong() + "/" );
@@ -91,29 +91,34 @@
         throws MojoExecutionException
     {
         File folder = new File( "target/a" );
-        File name = DependencyUtil.getFormattedOutputDirectory( false, false, false, folder, (Artifact) artifacts
-            .get( 0 ) );
+        final Artifact artifact = (Artifact) artifacts.get( 0 );
+        File name = DependencyUtil.getFormattedOutputDirectory( false, false, false, false, folder, artifact );
         // object is the same.
         assertEquals( folder, name );
 
-        name = DependencyUtil.getFormattedOutputDirectory( true, false, false, folder, (Artifact) artifacts.get( 0 ) );
-        String expectedResult = folder.getAbsolutePath() + File.separatorChar + "jars";
+        name = DependencyUtil.getFormattedOutputDirectory( false, false, true, false, folder, artifact );
+        String expectedResult = folder.getAbsolutePath() + File.separatorChar + "test" + File.separatorChar + "one"
+            + File.separatorChar + "1.1";
         assertTrue( expectedResult.equalsIgnoreCase( name.getAbsolutePath() ) );
 
-        name = DependencyUtil.getFormattedOutputDirectory( false, true, false, folder, (Artifact) artifacts.get( 0 ) );
+        name = DependencyUtil.getFormattedOutputDirectory( true, false, false, false, folder, artifact );
+        expectedResult = folder.getAbsolutePath() + File.separatorChar + "jars";
+        assertTrue( expectedResult.equalsIgnoreCase( name.getAbsolutePath() ) );
+
+        name = DependencyUtil.getFormattedOutputDirectory( false, true, false, false, folder, artifact );
         expectedResult = folder.getAbsolutePath() + File.separatorChar + "one-sources-1.1-jar";
         assertEquals( expectedResult, name.getAbsolutePath() );
 
-        name = DependencyUtil.getFormattedOutputDirectory( false, true, true, folder, (Artifact) artifacts.get( 0 ) );
+        name = DependencyUtil.getFormattedOutputDirectory( false, true, false, true, folder, artifact );
         expectedResult = folder.getAbsolutePath() + File.separatorChar + "one-sources-jar";
         assertEquals( expectedResult, name.getAbsolutePath() );
-        
-        name = DependencyUtil.getFormattedOutputDirectory( true, true, false, folder, (Artifact) artifacts.get( 0 ) );
+
+        name = DependencyUtil.getFormattedOutputDirectory( true, true, false, false, folder, artifact );
         expectedResult = folder.getAbsolutePath() + File.separatorChar + "jars" + File.separatorChar
             + "one-sources-1.1-jar";
         assertEquals( expectedResult, name.getAbsolutePath() );
-        
-        name = DependencyUtil.getFormattedOutputDirectory( true, true, true, folder, (Artifact) artifacts.get( 0 ) );
+
+        name = DependencyUtil.getFormattedOutputDirectory( true, true, false, true, folder, artifact );
         expectedResult = folder.getAbsolutePath() + File.separatorChar + "jars" + File.separatorChar
             + "one-sources-jar";
         assertEquals( expectedResult, name.getAbsolutePath() );
@@ -123,46 +128,50 @@
         throws MojoExecutionException
     {
         File folder = new File( "target/a" );
-        File name = DependencyUtil.getFormattedOutputDirectory( false, false, false, folder, (Artifact) artifacts
-            .get( 1 ) );
+        final Artifact artifact = (Artifact) artifacts.get( 1 );
+        File name = DependencyUtil.getFormattedOutputDirectory( false, false, false, false, folder, artifact );
         // object is the same.
         assertEquals( folder, name );
 
-        name = DependencyUtil.getFormattedOutputDirectory( true, false, false, folder, (Artifact) artifacts.get( 1 ) );
+        name = DependencyUtil.getFormattedOutputDirectory( true, false, false, false, folder, artifact );
         String expectedResult = folder.getAbsolutePath() + File.separatorChar + "wars";
         assertEquals( expectedResult, name.getAbsolutePath() );
 
-        name = DependencyUtil.getFormattedOutputDirectory( false, true, false, folder, (Artifact) artifacts.get( 1 ) );
+        name = DependencyUtil.getFormattedOutputDirectory( false, false, true, false, folder, artifact );
+        expectedResult = folder.getAbsolutePath() + File.separatorChar + "test" + File.separatorChar + "two"
+            + File.separatorChar + "1.1-SNAPSHOT";
+        assertEquals( expectedResult, name.getAbsolutePath() );
+
+        name = DependencyUtil.getFormattedOutputDirectory( false, true, false, false, folder, artifact );
         expectedResult = folder.getAbsolutePath() + File.separatorChar + "two-1.1-SNAPSHOT-war";
         assertEquals( expectedResult, name.getAbsolutePath() );
 
-        name = DependencyUtil.getFormattedOutputDirectory( true, true, false, folder, (Artifact) artifacts.get( 1 ) );
+        name = DependencyUtil.getFormattedOutputDirectory( true, true, false, false, folder, artifact );
         expectedResult = folder.getAbsolutePath() + File.separatorChar + "wars" + File.separatorChar
             + "two-1.1-SNAPSHOT-war";
         assertEquals( expectedResult, name.getAbsolutePath() );
-        
-        name = DependencyUtil.getFormattedOutputDirectory( false, true, true, folder, (Artifact) artifacts.get( 1 ) );
+
+        name = DependencyUtil.getFormattedOutputDirectory( false, true, false, true, folder, artifact );
         expectedResult = folder.getAbsolutePath() + File.separatorChar + "two-war";
         assertEquals( expectedResult, name.getAbsolutePath() );
 
-        name = DependencyUtil.getFormattedOutputDirectory( true, true, true, folder, (Artifact) artifacts.get( 1 ) );
-        expectedResult = folder.getAbsolutePath() + File.separatorChar + "wars" + File.separatorChar
-            + "two-war";
+        name = DependencyUtil.getFormattedOutputDirectory( true, true, false, true, folder, artifact );
+        expectedResult = folder.getAbsolutePath() + File.separatorChar + "wars" + File.separatorChar + "two-war";
         assertEquals( expectedResult, name.getAbsolutePath() );
     }
-    
+
     public void testDirectoryNameSources()
-    throws MojoExecutionException
-{
-    File folder = new File( "target/a" );
-    File name = DependencyUtil.getFormattedOutputDirectory( false, true, true, folder, sources );
-    String expectedResult = folder.getAbsolutePath() + File.separatorChar + "two-sources";
-    assertEquals( expectedResult, name.getAbsolutePath() );
-    
-    name = DependencyUtil.getFormattedOutputDirectory( false, true, false, folder, sources );
-    expectedResult = folder.getAbsolutePath() + File.separatorChar + "two-sources-1.1-SNAPSHOT-sources";
-    assertEquals( expectedResult, name.getAbsolutePath() );
-}
+        throws MojoExecutionException
+    {
+        File folder = new File( "target/a" );
+        File name = DependencyUtil.getFormattedOutputDirectory( false, true, false, true, folder, sources );
+        String expectedResult = folder.getAbsolutePath() + File.separatorChar + "two-sources";
+        assertEquals( expectedResult, name.getAbsolutePath() );
+
+        name = DependencyUtil.getFormattedOutputDirectory( false, true, false, false, folder, sources );
+        expectedResult = folder.getAbsolutePath() + File.separatorChar + "two-sources-1.1-SNAPSHOT-sources";
+        assertEquals( expectedResult, name.getAbsolutePath() );
+    }
 
     public void testFileName()
         throws MojoExecutionException

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?view=diff&rev=510766&r1=510765&r2=510766
==============================================================================
--- 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 Thu Feb 22 18:24:41 2007
@@ -82,8 +82,8 @@
         throws IOException
     {
         File destFolder = DependencyUtil.getFormattedOutputDirectory( useSubDirectoryPerType,
-                                                                      useSubDirectoryPerArtifact, false, outputFolder,
-                                                                      artifact );
+                                                                      useSubDirectoryPerArtifact, false, false,
+                                                                      outputFolder, artifact );
         File destFile = new File( destFolder, DependencyUtil.getFormattedFileName( artifact, removeVersion ) );
 
         destFile.getParentFile().mkdirs();