mirror of https://github.com/apache/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/trunk@645955 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
66612a985f
commit
f4e428ee64
|
@ -43,7 +43,8 @@ public abstract class AbstractLegacyRepositoryContent
|
||||||
{
|
{
|
||||||
typeToDirectoryMap = new HashMap<String, String>();
|
typeToDirectoryMap = new HashMap<String, String>();
|
||||||
typeToDirectoryMap.put( "ejb-client", "ejb" );
|
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-tgz", "distribution" );
|
||||||
typeToDirectoryMap.put( "distribution-zip", "distribution" );
|
typeToDirectoryMap.put( "distribution-zip", "distribution" );
|
||||||
typeToDirectoryMap.put( "javadoc", "javadoc.jar" );
|
typeToDirectoryMap.put( "javadoc", "javadoc.jar" );
|
||||||
|
|
|
@ -34,6 +34,8 @@ public class ArtifactExtensionMapping
|
||||||
public static final String MAVEN_ARCHETYPE = "maven-archetype";
|
public static final String MAVEN_ARCHETYPE = "maven-archetype";
|
||||||
|
|
||||||
public static final String MAVEN_PLUGIN = "maven-plugin";
|
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;
|
private static final Map<String, String> typeToExtensionMap;
|
||||||
|
|
||||||
|
@ -52,6 +54,7 @@ public class ArtifactExtensionMapping
|
||||||
typeToExtensionMap.put( "aspect", "jar" );
|
typeToExtensionMap.put( "aspect", "jar" );
|
||||||
typeToExtensionMap.put( "uberjar", "jar" );
|
typeToExtensionMap.put( "uberjar", "jar" );
|
||||||
typeToExtensionMap.put( MAVEN_PLUGIN, "jar" );
|
typeToExtensionMap.put( MAVEN_PLUGIN, "jar" );
|
||||||
|
typeToExtensionMap.put( MAVEN_ONE_PLUGIN, "jar" );
|
||||||
typeToExtensionMap.put( MAVEN_ARCHETYPE, "jar" );
|
typeToExtensionMap.put( MAVEN_ARCHETYPE, "jar" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class LegacyPathParser
|
||||||
// Special Case with Maven Plugins
|
// Special Case with Maven Plugins
|
||||||
if ( StringUtils.equals( "jar", extension ) && StringUtils.equals( "plugins", expectedType ) )
|
if ( StringUtils.equals( "jar", extension ) && StringUtils.equals( "plugins", expectedType ) )
|
||||||
{
|
{
|
||||||
artifact.setType( ArtifactExtensionMapping.MAVEN_PLUGIN );
|
artifact.setType( ArtifactExtensionMapping.MAVEN_ONE_PLUGIN );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -271,7 +271,7 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String groupId = "maven";
|
String groupId = "maven";
|
||||||
String artifactId = "maven-test-plugin";
|
String artifactId = "maven-test-plugin";
|
||||||
String version = "1.8.2";
|
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";
|
String path = "maven/plugins/maven-test-plugin-1.8.2.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, null, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
|
@ -286,7 +286,7 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String groupId = "avalon-meta";
|
String groupId = "avalon-meta";
|
||||||
String artifactId = "avalon-meta-plugin";
|
String artifactId = "avalon-meta-plugin";
|
||||||
String version = "1.1";
|
String version = "1.1";
|
||||||
String type = "maven-plugin";
|
String type = "maven-one-plugin";
|
||||||
String path = "avalon-meta/plugins/avalon-meta-plugin-1.1.jar";
|
String path = "avalon-meta/plugins/avalon-meta-plugin-1.1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, null, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
|
@ -301,7 +301,7 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String groupId = "cactus";
|
String groupId = "cactus";
|
||||||
String artifactId = "cactus-maven";
|
String artifactId = "cactus-maven";
|
||||||
String version = "1.7dev-20040815";
|
String version = "1.7dev-20040815";
|
||||||
String type = "maven-plugin";
|
String type = "maven-one-plugin";
|
||||||
String path = "cactus/plugins/cactus-maven-1.7dev-20040815.jar";
|
String path = "cactus/plugins/cactus-maven-1.7dev-20040815.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, null, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
|
@ -316,12 +316,28 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String groupId = "geronimo";
|
String groupId = "geronimo";
|
||||||
String artifactId = "geronimo-packaging-plugin";
|
String artifactId = "geronimo-packaging-plugin";
|
||||||
String version = "1.0.1";
|
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";
|
String path = "geronimo/plugins/geronimo-packaging-plugin-1.0.1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, null, type );
|
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.
|
* Perform a roundtrip through the layout routines to determine success.
|
||||||
* @param classifier TODO
|
* @param classifier TODO
|
||||||
|
|
|
@ -340,7 +340,7 @@ public class LegacyPathParserTest
|
||||||
String groupId = "maven";
|
String groupId = "maven";
|
||||||
String artifactId = "maven-test-plugin";
|
String artifactId = "maven-test-plugin";
|
||||||
String version = "1.8.2";
|
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";
|
String path = "maven/plugins/maven-test-plugin-1.8.2.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, null, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
|
@ -355,7 +355,7 @@ public class LegacyPathParserTest
|
||||||
String groupId = "avalon-meta";
|
String groupId = "avalon-meta";
|
||||||
String artifactId = "avalon-meta-plugin";
|
String artifactId = "avalon-meta-plugin";
|
||||||
String version = "1.1";
|
String version = "1.1";
|
||||||
String type = "maven-plugin";
|
String type = "maven-one-plugin";
|
||||||
String path = "avalon-meta/plugins/avalon-meta-plugin-1.1.jar";
|
String path = "avalon-meta/plugins/avalon-meta-plugin-1.1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, null, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
|
@ -370,7 +370,7 @@ public class LegacyPathParserTest
|
||||||
String groupId = "cactus";
|
String groupId = "cactus";
|
||||||
String artifactId = "cactus-maven";
|
String artifactId = "cactus-maven";
|
||||||
String version = "1.7dev-20040815";
|
String version = "1.7dev-20040815";
|
||||||
String type = "maven-plugin";
|
String type = "maven-one-plugin";
|
||||||
String path = "cactus/plugins/cactus-maven-1.7dev-20040815.jar";
|
String path = "cactus/plugins/cactus-maven-1.7dev-20040815.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, null, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
|
@ -385,7 +385,7 @@ public class LegacyPathParserTest
|
||||||
String groupId = "geronimo";
|
String groupId = "geronimo";
|
||||||
String artifactId = "geronimo-packaging-plugin";
|
String artifactId = "geronimo-packaging-plugin";
|
||||||
String version = "1.0.1";
|
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";
|
String path = "geronimo/plugins/geronimo-packaging-plugin-1.0.1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, null, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
|
|
Loading…
Reference in New Issue