]> source.dussan.org Git - archiva.git/commitdiff
MRM-768 : use a distinct "type" for maven1 and maven2 plugins to avoid conflicts...
authorNicolas De Loof <nicolas@apache.org>
Tue, 8 Apr 2008 14:59:37 +0000 (14:59 +0000)
committerNicolas De Loof <nicolas@apache.org>
Tue, 8 Apr 2008 14:59:37 +0000 (14:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches@645962 13f79535-47bb-0310-9956-ffa450edef68

archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java
archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java
archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java
archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContentTestCase.java
archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java

index 018d86e4f4cfce5bb7d1b438eaab377a862a996b..f135d5aad5985d803d55949d4213810758d9fe5a 100644 (file)
@@ -43,7 +43,8 @@ public abstract class AbstractLegacyRepositoryContent
     {
         typeToDirectoryMap = new HashMap<String, String>();
         typeToDirectoryMap.put( "ejb-client", "ejb" );
-        typeToDirectoryMap.put( ArtifactExtensionMapping.MAVEN_PLUGIN, "plugin" );
+        typeToDirectoryMap.put( ArtifactExtensionMapping.MAVEN_PLUGIN, "maven-plugin" );
+        typeToDirectoryMap.put( ArtifactExtensionMapping.MAVEN_ONE_PLUGIN, "plugin" );
         typeToDirectoryMap.put( "distribution-tgz", "distribution" );
         typeToDirectoryMap.put( "distribution-zip", "distribution" );
         typeToDirectoryMap.put( "javadoc", "javadoc.jar" );
index 5c9300b7095ac6aabf6d1ad81ead043e84574c4e..e7cd021a8abc57b2d126da41c45fcf98c9b13768 100644 (file)
@@ -34,6 +34,8 @@ public class ArtifactExtensionMapping
     public static final String MAVEN_ARCHETYPE = "maven-archetype";
 
     public static final String MAVEN_PLUGIN = "maven-plugin";
+       
+       public static final String MAVEN_ONE_PLUGIN = "maven-one-plugin";
 
     private static final Map<String, String> typeToExtensionMap;
 
@@ -52,6 +54,7 @@ public class ArtifactExtensionMapping
         typeToExtensionMap.put( "aspect", "jar" );
         typeToExtensionMap.put( "uberjar", "jar" );
         typeToExtensionMap.put( MAVEN_PLUGIN, "jar" );
+        typeToExtensionMap.put( MAVEN_ONE_PLUGIN, "jar" );
         typeToExtensionMap.put( MAVEN_ARCHETYPE, "jar" );
     }
 
index 0cf3b39978e07110dc52b634df554770e691eebe..2d2baa97d4e12143e5c024028cbf420cbdfbe192 100644 (file)
@@ -191,7 +191,7 @@ public class LegacyPathParser
         // Special Case with Maven Plugins
         if ( StringUtils.equals( "jar", extension ) && StringUtils.equals( "plugins", expectedType ) )
         {
-            artifact.setType( ArtifactExtensionMapping.MAVEN_PLUGIN );
+            artifact.setType( ArtifactExtensionMapping.MAVEN_ONE_PLUGIN );
         }
         else
         {
index 998eea8279f0e60cd0997b12a63c5c410cfbe468..4fddac331e8f08c2b8e01a4fbbfe130ea86a3db0 100644 (file)
@@ -271,7 +271,7 @@ public abstract class AbstractLegacyRepositoryContentTestCase
         String groupId = "maven";
         String artifactId = "maven-test-plugin";
         String version = "1.8.2";
-        String type = "maven-plugin";
+        String type = "maven-one-plugin";
         String path = "maven/plugins/maven-test-plugin-1.8.2.jar";
 
         assertLayout( path, groupId, artifactId, version, null, type );
@@ -286,7 +286,7 @@ public abstract class AbstractLegacyRepositoryContentTestCase
         String groupId = "avalon-meta";
         String artifactId = "avalon-meta-plugin";
         String version = "1.1";
-        String type = "maven-plugin";
+        String type = "maven-one-plugin";
         String path = "avalon-meta/plugins/avalon-meta-plugin-1.1.jar";
 
         assertLayout( path, groupId, artifactId, version, null, type );
@@ -301,7 +301,7 @@ public abstract class AbstractLegacyRepositoryContentTestCase
         String groupId = "cactus";
         String artifactId = "cactus-maven";
         String version = "1.7dev-20040815";
-        String type = "maven-plugin";
+        String type = "maven-one-plugin";
         String path = "cactus/plugins/cactus-maven-1.7dev-20040815.jar";
 
         assertLayout( path, groupId, artifactId, version, null, type );
@@ -316,12 +316,28 @@ public abstract class AbstractLegacyRepositoryContentTestCase
         String groupId = "geronimo";
         String artifactId = "geronimo-packaging-plugin";
         String version = "1.0.1";
-        String type = "maven-plugin";
+        String type = "maven-one-plugin";
         String path = "geronimo/plugins/geronimo-packaging-plugin-1.0.1.jar";
 
         assertLayout( path, groupId, artifactId, version, null, type );
     }
 
+       /**
+        * [MRM-768] Artifact type "maven-plugin" does not distinguish maven1 and maven2 plugins. 
+        * This produces conflicts when m2 plugins are stored in legacy-layout repository
+        */
+       public void testMaven1Maven2PluginTypeDistinc()
+           throws Exception
+    {
+        String groupId = "com.sun.tools.xjc.maven2";
+        String artifactId = "maven-jaxb-plugin";
+        String version = "1.1";
+        String type = "maven-plugin";
+        String path = "com.sun.tools.xjc.maven2/maven-plugins/maven-jaxb-plugin-1.1.jar";
+
+        assertLayout( path, groupId, artifactId, version, null, type );
+       }
+       
     /**
      * Perform a roundtrip through the layout routines to determine success.
      * @param classifier TODO
index c86d66ff1fae249d24b703cda50d47c0078e33e6..cb1d3544cbdb2be5ad3b539eb7f3d9a04f4edab9 100644 (file)
@@ -340,7 +340,7 @@ public class LegacyPathParserTest
         String groupId = "maven";
         String artifactId = "maven-test-plugin";
         String version = "1.8.2";
-        String type = "maven-plugin";
+        String type = "maven-one-plugin";
         String path = "maven/plugins/maven-test-plugin-1.8.2.jar";
 
         assertLayout( path, groupId, artifactId, version, null, type );
@@ -355,7 +355,7 @@ public class LegacyPathParserTest
         String groupId = "avalon-meta";
         String artifactId = "avalon-meta-plugin";
         String version = "1.1";
-        String type = "maven-plugin";
+        String type = "maven-one-plugin";
         String path = "avalon-meta/plugins/avalon-meta-plugin-1.1.jar";
 
         assertLayout( path, groupId, artifactId, version, null, type );
@@ -370,7 +370,7 @@ public class LegacyPathParserTest
         String groupId = "cactus";
         String artifactId = "cactus-maven";
         String version = "1.7dev-20040815";
-        String type = "maven-plugin";
+        String type = "maven-one-plugin";
         String path = "cactus/plugins/cactus-maven-1.7dev-20040815.jar";
 
         assertLayout( path, groupId, artifactId, version, null, type );
@@ -385,7 +385,7 @@ public class LegacyPathParserTest
         String groupId = "geronimo";
         String artifactId = "geronimo-packaging-plugin";
         String version = "1.0.1";
-        String type = "maven-plugin";
+        String type = "maven-one-plugin";
         String path = "geronimo/plugins/geronimo-packaging-plugin-1.0.1.jar";
 
         assertLayout( path, groupId, artifactId, version, null, type );