aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-discoverer/src
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2006-09-13 05:21:12 +0000
committerBrett Porter <brett@apache.org>2006-09-13 05:21:12 +0000
commit7d6f2e71223e0fca50b5e0a98e1817814a5aba2b (patch)
tree492e28d4591cb3d66dacaf24b8889c4f7ed9726e /archiva-discoverer/src
parent74797f8efecb94f14c631fa712c1925828027d53 (diff)
downloadarchiva-7d6f2e71223e0fca50b5e0a98e1817814a5aba2b.tar.gz
archiva-7d6f2e71223e0fca50b5e0a98e1817814a5aba2b.zip
[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
Diffstat (limited to 'archiva-discoverer/src')
-rw-r--r--archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/LegacyArtifactDiscoverer.java10
-rw-r--r--archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/LegacyArtifactDiscovererTest.java31
2 files changed, 40 insertions, 1 deletions
diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/LegacyArtifactDiscoverer.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/LegacyArtifactDiscoverer.java
index 361a6f9a3..6abb95842 100644
--- a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/LegacyArtifactDiscoverer.java
+++ b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/LegacyArtifactDiscoverer.java
@@ -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 );
diff --git a/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/LegacyArtifactDiscovererTest.java b/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/LegacyArtifactDiscovererTest.java
index 51b0d8503..9694c87bf 100644
--- a/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/LegacyArtifactDiscovererTest.java
+++ b/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/LegacyArtifactDiscovererTest.java
@@ -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
{