[MRM-163] add support for legacy repo javadoc and source jars

Submitted by: nicolas de loof


git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@442847 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2006-09-13 05:21:12 +00:00
parent 74797f8efe
commit 7d6f2e7122
2 changed files with 40 additions and 1 deletions

View File

@ -90,6 +90,14 @@ public class LegacyArtifactDiscoverer
avceTokenList.addLast( lastAvceToken );
}
else if ( lastAvceToken.endsWith( "javadoc.jar" ) )
{
type = "javadoc.jar";
lastAvceToken = lastAvceToken.substring( 0, lastAvceToken.length() - ".jar".length() );
avceTokenList.addLast( lastAvceToken );
}
else if ( lastAvceToken.endsWith( ".zip" ) )
{
type = "distribution-zip";
@ -105,7 +113,7 @@ public class LegacyArtifactDiscoverer
if ( extPos > 0 )
{
String ext = lastAvceToken.substring( extPos + 1 );
if ( type.equals( ext ) )
if ( type.equals( ext ) || "plugin".equals( type ) )
{
lastAvceToken = lastAvceToken.substring( 0, extPos );

View File

@ -482,6 +482,37 @@ public class LegacyArtifactDiscovererTest
assertEquals( createArtifact( "javax.sql", "jdbc", "2.0" ), artifact );
}
public void testJavadoc()
throws ComponentLookupException, DiscovererException
{
String testPath = "javax.sql/javadoc.jars/jdbc-2.0-javadoc.jar";
Artifact artifact = discoverer.buildArtifact( testPath );
assertEquals( createArtifact( "javax.sql", "jdbc", "2.0", "javadoc.jar", "javadoc" ), artifact );
}
public void testSources()
throws ComponentLookupException, DiscovererException
{
String testPath = "javax.sql/java-sources/jdbc-2.0-sources.jar";
Artifact artifact = discoverer.buildArtifact( testPath );
assertEquals( createArtifact( "javax.sql", "jdbc", "2.0", "java-source", "sources" ), artifact );
}
public void testPlugin()
throws ComponentLookupException, DiscovererException
{
String testPath = "maven/plugins/maven-test-plugin-1.8.jar";
Artifact artifact = discoverer.buildArtifact( testPath );
assertEquals( createArtifact( "maven", "maven-test-plugin", "1.8", "plugin" ), artifact );
}
private List discoverArtifacts()
throws DiscovererException
{