From: Nicolas De Loof Date: Tue, 8 Apr 2008 14:59:37 +0000 (+0000) Subject: MRM-768 : use a distinct "type" for maven1 and maven2 plugins to avoid conflicts... X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ff77c908cf009d78f3de86d6d75936576badd430;p=archiva.git MRM-768 : use a distinct "type" for maven1 and maven2 plugins to avoid conflicts when M2 plugins are stored in M1 repo git-svn-id: https://svn.apache.org/repos/asf/archiva/branches@645962 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java index 018d86e4f..f135d5aad 100644 --- a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java +++ b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java @@ -43,7 +43,8 @@ public abstract class AbstractLegacyRepositoryContent { typeToDirectoryMap = new HashMap(); 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" ); diff --git a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java index 5c9300b70..e7cd021a8 100644 --- a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java +++ b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java @@ -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 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" ); } diff --git a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java index 0cf3b3997..2d2baa97d 100644 --- a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java +++ b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java @@ -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 { diff --git a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContentTestCase.java b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContentTestCase.java index 998eea827..4fddac331 100644 --- a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContentTestCase.java +++ b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContentTestCase.java @@ -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 diff --git a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java index c86d66ff1..cb1d3544c 100644 --- a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java +++ b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java @@ -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 );