Browse Source

[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
tags/archiva-1.4-M3
Olivier Lamy 12 years ago
parent
commit
3c805f8f2d

+ 11
- 0
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/RepositoryRequest.java 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.

+ 8
- 0
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java 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
{

+ 10
- 0
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java 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();

Loading…
Cancel
Save