[MRM-1645] mvn archetype:generate -DarchetypeCatalog (archetype-catalog.xml) failing with Not a valid artifact path.

Submitted by Charles Kim.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1367107 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-07-30 14:39:31 +00:00
parent 6fa6750970
commit 3c805f8f2d
3 changed files with 29 additions and 0 deletions

View File

@ -103,6 +103,17 @@ public class RepositoryRequest
return requestedPath.endsWith( "/" + MetadataTools.MAVEN_METADATA );
}
/**
*
* @param requestedPath
* @return true if the requestedPath is likely an archetype catalog request.
*/
public boolean isArchetypeCatalog( String requestedPath )
{
//TODO: Make it static final String
return requestedPath.endsWith( "/archetype-catalog.xml");
}
/**
* <p>
* Tests the path to see if it conforms to the expectations of a support file request.

View File

@ -688,6 +688,14 @@ public class ArchivaDavResourceFactory
return connectors.fetchMetatadaFromProxies( managedRepository, path ) != null;
}
// Is it an Archetype Catalog?
if ( repositoryRequest.isArchetypeCatalog( path ) )
{
File proxiedFile = connectors.fetchFromProxies( managedRepository, path );
return ( proxiedFile != null );
}
// Not any of the above? Then it's gotta be an artifact reference.
try
{

View File

@ -241,6 +241,9 @@ public class ArchivaDavResourceFactoryTest
"target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ),
internalRepo );
repoRequestControl.expectAndReturn(
repoRequest.isArchetypeCatalog( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
false );
archivaConfigurationControl.replay();
requestControl.replay();
@ -309,6 +312,9 @@ public class ArchivaDavResourceFactoryTest
internalRepo ),
new File( config.findManagedRepositoryById( INTERNAL_REPO ).getLocation(),
"target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
repoRequestControl.expectAndReturn(
repoRequest.isArchetypeCatalog( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
false );
archivaConfigurationControl.replay();
requestControl.replay();
@ -387,6 +393,10 @@ public class ArchivaDavResourceFactoryTest
new File( config.findManagedRepositoryById( LOCAL_MIRROR_REPO ).getLocation(),
"target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
repoRequestControl.expectAndReturn(
repoRequest.isArchetypeCatalog( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
false , 2);
archivaConfigurationControl.replay();
requestControl.replay();
repoContentFactoryControl.replay();