[MRM-1473] remove use of plexus-spring

remove all dependencies to plexus-container
use of sisu-inject-plexus (version 2.2.2 with ASL license) for components using maven api components.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1128075 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-05-26 20:52:13 +00:00
parent 16714e5e4d
commit 1788eb54c4
32 changed files with 247 additions and 204 deletions

View File

@ -32,12 +32,6 @@
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-scanner</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-dependency-tree-consumer</artifactId>
<version>1.4-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-metadata-consumer</artifactId>
@ -64,10 +58,6 @@
<artifactId>cli</artifactId>
<version>7</version>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>

View File

@ -33,11 +33,6 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-repository-metadata</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>

View File

@ -46,20 +46,16 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-plexus</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>

View File

@ -55,14 +55,15 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-digest</artifactId>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>

View File

@ -50,10 +50,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components.registry</groupId>
<artifactId>spring-registry-api</artifactId>
@ -74,11 +70,6 @@
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>

View File

@ -53,10 +53,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components.registry</groupId>
<artifactId>spring-registry-api</artifactId>

View File

@ -48,11 +48,6 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-i18n</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>

View File

@ -40,11 +40,6 @@
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queries</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
@ -52,6 +47,12 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-digest</artifactId>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-lang</groupId>

View File

@ -40,11 +40,6 @@
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-common</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>

View File

@ -28,11 +28,6 @@
<artifactId>archiva-proxy</artifactId>
<name>Archiva Base :: Proxy</name>
<dependencies>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-configuration</artifactId>
@ -65,10 +60,12 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-digest</artifactId>
</dependency>
<dependency>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components.registry</groupId>

View File

@ -35,20 +35,17 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-digest</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>

View File

@ -35,11 +35,6 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -28,11 +28,6 @@
<artifactId>archiva-rss</artifactId>
<name>Archiva Web :: RSS</name>
<dependencies>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>metadata-repository-api</artifactId>

View File

@ -140,6 +140,12 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-slf4j-logging</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@ -191,10 +197,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</dependency>
<!-- Plexus Security Dependencies -->
<dependency>
<groupId>org.codehaus.redback</groupId>
@ -241,6 +243,12 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-quartz</artifactId>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>

View File

@ -80,10 +80,6 @@
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>

View File

@ -50,18 +50,11 @@
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<!-- use spring for the unit tests?
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
-->
<dependency>
<groupId>org.codehaus.redback</groupId>
<artifactId>redback-authorization-rbac</artifactId>

View File

@ -79,11 +79,6 @@
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>

View File

@ -26,6 +26,14 @@
<artifactId>metadata-repository-api</artifactId>
<name>Archiva Metadata Repository API</name>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>metadata-model</artifactId>
@ -34,11 +42,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -30,7 +30,12 @@ import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataN
import org.apache.archiva.repository.events.RepositoryListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -38,42 +43,57 @@ import java.util.List;
/**
* Default implementation of the metadata resolver API. At present it will handle updating the content repository
* from new or changed information in the model and artifacts from the repository storage.
*
* <p/>
* This is a singleton component to allow an alternate implementation to be provided. It is intended to be the same
* system-wide for the whole content repository instead of on a per-managed-repository basis. Therefore, the session is
* passed in as an argument to obtain any necessary resources, rather than the class being instantiated within the
* session in the context of a single managed repository's resolution needs.
*
* <p/>
* Note that the caller is responsible for the session, such as closing and saving (which is implied by the resolver
* being obtained from within the session). The {@link RepositorySession#markDirty()} method is used as a hint to ensure
* that the session knows we've made changes at close. We cannot ensure the changes will be persisted if the caller
* chooses to revert first. This is preferable to storing the metadata immediately - a separate session would require
* having a bi-directional link with the session factory, and saving the existing session might save other changes
* unknowingly by the caller.
*
* @plexus.component role="org.apache.archiva.metadata.repository.MetadataResolver"
* <p/>
* plexus.component role="org.apache.archiva.metadata.repository.MetadataResolver"
*/
@Service( "metadataResolver#default" )
public class DefaultMetadataResolver
implements MetadataResolver
{
private Logger log = LoggerFactory.getLogger( DefaultMetadataResolver.class );
/**
* FIXME: this needs to be configurable based on storage type - and could also be instantiated per repo. Change to a
* factory, and perhaps retrieve from the session. We should avoid creating one per request, however.
*
* <p/>
* TODO: Also need to accommodate availability of proxy module
* ... could be a different type since we need methods to modify the storage metadata, which would also allow more
* appropriate methods to pass in the already determined repository configuration, for example, instead of the ID
*
* @plexus.requirement role-hint="maven2"
*/
@Inject
@Named( value = "repositoryStorage#maven2" )
private RepositoryStorage repositoryStorage;
/**
* @plexus.requirement role="org.apache.archiva.repository.events.RepositoryListener"
* plexus.requirement role="org.apache.archiva.repository.events.RepositoryListener"
*/
private List<RepositoryListener> listeners;
private static final Logger log = LoggerFactory.getLogger( DefaultMetadataResolver.class );
@Inject
private ApplicationContext applicationContext;
@PostConstruct
private void initialize()
{
listeners =
new ArrayList<RepositoryListener>( applicationContext.getBeansOfType( RepositoryListener.class ).values() );
}
public ProjectVersionMetadata resolveProjectVersion( RepositorySession session, String repoId, String namespace,
String projectId, String projectVersion )
@ -81,8 +101,8 @@ public class DefaultMetadataResolver
{
MetadataRepository metadataRepository = session.getRepository();
ProjectVersionMetadata metadata = metadataRepository.getProjectVersion( repoId, namespace, projectId,
projectVersion );
ProjectVersionMetadata metadata =
metadataRepository.getProjectVersion( repoId, namespace, projectId, projectVersion );
// TODO: do we want to detect changes as well by comparing timestamps? isProjectVersionNewerThan(updated)
// in such cases we might also remove/update stale metadata, including adjusting plugin-based facets
// This would also be better than checking for completeness - we can then refresh only when fixed (though
@ -159,8 +179,8 @@ public class DefaultMetadataResolver
{
MetadataRepository metadataRepository = session.getRepository();
Collection<String> namespaces = metadataRepository.getRootNamespaces( repoId );
Collection<String> storageNamespaces = repositoryStorage.listRootNamespaces( repoId, new ExcludesFilter<String>(
namespaces ) );
Collection<String> storageNamespaces =
repositoryStorage.listRootNamespaces( repoId, new ExcludesFilter<String>( namespaces ) );
if ( storageNamespaces != null && !storageNamespaces.isEmpty() )
{
if ( log.isDebugEnabled() )
@ -193,9 +213,8 @@ public class DefaultMetadataResolver
Collection<String> namespaces = metadataRepository.getNamespaces( repoId, namespace );
Collection<String> exclusions = new ArrayList<String>( namespaces );
exclusions.addAll( metadataRepository.getProjects( repoId, namespace ) );
Collection<String> storageNamespaces = repositoryStorage.listNamespaces( repoId, namespace,
new ExcludesFilter<String>(
exclusions ) );
Collection<String> storageNamespaces =
repositoryStorage.listNamespaces( repoId, namespace, new ExcludesFilter<String>( exclusions ) );
if ( storageNamespaces != null && !storageNamespaces.isEmpty() )
{
if ( log.isDebugEnabled() )
@ -228,8 +247,8 @@ public class DefaultMetadataResolver
Collection<String> projects = metadataRepository.getProjects( repoId, namespace );
Collection<String> exclusions = new ArrayList<String>( projects );
exclusions.addAll( metadataRepository.getNamespaces( repoId, namespace ) );
Collection<String> storageProjects = repositoryStorage.listProjects( repoId, namespace,
new ExcludesFilter<String>( exclusions ) );
Collection<String> storageProjects =
repositoryStorage.listProjects( repoId, namespace, new ExcludesFilter<String>( exclusions ) );
if ( storageProjects != null && !storageProjects.isEmpty() )
{
if ( log.isDebugEnabled() )
@ -278,10 +297,8 @@ public class DefaultMetadataResolver
{
try
{
ProjectVersionMetadata versionMetadata = repositoryStorage.readProjectVersionMetadata( repoId,
namespace,
projectId,
projectVersion );
ProjectVersionMetadata versionMetadata =
repositoryStorage.readProjectVersionMetadata( repoId, namespace, projectId, projectVersion );
for ( RepositoryListener listener : listeners )
{
listener.addArtifact( session, repoId, namespace, projectId, versionMetadata );
@ -295,8 +312,8 @@ public class DefaultMetadataResolver
}
catch ( RepositoryStorageMetadataInvalidException e )
{
log.warn( "Not update project in metadata repository due to an error resolving it from storage: " +
e.getMessage() );
log.warn( "Not update project in metadata repository due to an error resolving it from storage: "
+ e.getMessage() );
for ( RepositoryListener listener : listeners )
{
@ -324,13 +341,11 @@ public class DefaultMetadataResolver
throws MetadataResolutionException
{
MetadataRepository metadataRepository = session.getRepository();
Collection<ArtifactMetadata> artifacts = metadataRepository.getArtifacts( repoId, namespace, projectId,
projectVersion );
Collection<ArtifactMetadata> artifacts =
metadataRepository.getArtifacts( repoId, namespace, projectId, projectVersion );
ExcludesFilter<String> filter = new ExcludesFilter<String>( createArtifactIdList( artifacts ) );
Collection<ArtifactMetadata> storageArtifacts = repositoryStorage.readArtifactsMetadata( repoId, namespace,
projectId,
projectVersion,
filter );
Collection<ArtifactMetadata> storageArtifacts =
repositoryStorage.readArtifactsMetadata( repoId, namespace, projectId, projectVersion, filter );
if ( storageArtifacts != null && !storageArtifacts.isEmpty() )
{
if ( log.isDebugEnabled() )

View File

@ -0,0 +1,34 @@
<?xml version="1.0"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="true">
<context:annotation-config/>
<context:component-scan base-package="org.apache.archiva.metadata.repository"/>
</beans>

View File

@ -19,6 +19,7 @@ package org.apache.archiva.metadata.repository;
* under the License.
*/
import junit.framework.TestCase;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.CiManagement;
import org.apache.archiva.metadata.model.Dependency;
@ -31,7 +32,6 @@ import org.apache.archiva.metadata.model.Organization;
import org.apache.archiva.metadata.model.ProjectMetadata;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.metadata.model.Scm;
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
import java.util.ArrayList;
import java.util.Arrays;
@ -44,7 +44,7 @@ import java.util.List;
import java.util.Map;
public abstract class AbstractMetadataRepositoryTest
extends PlexusInSpringTestCase
extends TestCase
{
protected static final String OTHER_REPO_ID = "other-repo";

View File

@ -38,9 +38,13 @@
<artifactId>metadata-repository-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-plexus</artifactId>
</dependency>
<dependency>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-guice</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
@ -92,7 +96,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>3.0-alpha-4</version>
<version>3.0.3</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@ -19,12 +19,15 @@ package org.apache.archiva.metadata.repository.storage.maven2;
* under the License.
*/
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
* @plexus.component role="org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider" role-hint="default"
* plexus.component role="org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider" role-hint="default"
*/
@Service( "artifactMappingProvider#default" )
public class DefaultArtifactMappingProvider
implements ArtifactMappingProvider
{

View File

@ -22,15 +22,21 @@ package org.apache.archiva.metadata.repository.storage.maven2;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.maven.archiva.common.utils.VersionUtil;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @plexus.component role="org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator" role-hint="maven2"
* plexus.component role="org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator" role-hint="maven2"
*/
@Service( "repositoryPathTranslator#maven2" )
public class Maven2RepositoryPathTranslator
implements RepositoryPathTranslator
{
@ -40,15 +46,29 @@ public class Maven2RepositoryPathTranslator
private static final Pattern TIMESTAMP_PATTERN = Pattern.compile( "([0-9]{8}.[0-9]{6})-([0-9]+).*" );
@Inject
private ApplicationContext applicationContext;
/**
* @plexus.requirement role="org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider"
* plexus.requirement role="org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider"
* see #initialize
*/
private List<ArtifactMappingProvider> artifactMappingProviders;
public Maven2RepositoryPathTranslator()
{
// noop
}
@PostConstruct
public void initialize()
{
artifactMappingProviders = new ArrayList<ArtifactMappingProvider>(
applicationContext.getBeansOfType( ArtifactMappingProvider.class ).values() );
}
public Maven2RepositoryPathTranslator( List<ArtifactMappingProvider> artifactMappingProviders )
{
this.artifactMappingProviders = artifactMappingProviders;
@ -165,8 +185,8 @@ public class Maven2RepositoryPathTranslator
{
if ( !id.startsWith( projectId + "-" ) )
{
throw new IllegalArgumentException( "Not a valid artifact path in a Maven 2 repository, filename '" + id +
"' doesn't start with artifact ID '" + projectId + "'" );
throw new IllegalArgumentException( "Not a valid artifact path in a Maven 2 repository, filename '" + id
+ "' doesn't start with artifact ID '" + projectId + "'" );
}
MavenArtifactFacet facet = new MavenArtifactFacet();
@ -201,17 +221,17 @@ public class Maven2RepositoryPathTranslator
}
catch ( IllegalStateException e )
{
throw new IllegalArgumentException(
"Not a valid artifact path in a Maven 2 repository, filename '" + id +
"' doesn't contain a timestamped version matching snapshot '" + projectVersion + "'" );
throw new IllegalArgumentException( "Not a valid artifact path in a Maven 2 repository, filename '" + id
+ "' doesn't contain a timestamped version matching snapshot '"
+ projectVersion + "'" );
}
}
else
{
// invalid
throw new IllegalArgumentException(
"Not a valid artifact path in a Maven 2 repository, filename '" + id + "' doesn't contain version '" +
projectVersion + "'" );
"Not a valid artifact path in a Maven 2 repository, filename '" + id + "' doesn't contain version '"
+ projectVersion + "'" );
}
String classifier;
@ -249,9 +269,9 @@ public class Maven2RepositoryPathTranslator
}
else
{
throw new IllegalArgumentException(
"Not a valid artifact path in a Maven 2 repository, filename '" + id +
"' expected classifier or extension but got '" + id.substring( index ) + "'" );
throw new IllegalArgumentException( "Not a valid artifact path in a Maven 2 repository, filename '" + id
+ "' expected classifier or extension but got '"
+ id.substring( index ) + "'" );
}
}

View File

@ -41,6 +41,7 @@ import org.apache.maven.model.MailingList;
import org.apache.maven.model.Model;
import org.apache.maven.model.Organization;
import org.apache.maven.model.Scm;
import org.apache.maven.model.building.DefaultModelBuilder;
import org.apache.maven.model.building.DefaultModelBuildingRequest;
import org.apache.maven.model.building.ModelBuilder;
import org.apache.maven.model.building.ModelBuildingException;
@ -48,6 +49,9 @@ import org.apache.maven.model.building.ModelBuildingRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
@ -67,7 +71,7 @@ import java.util.List;
* The session is passed in as an argument to obtain any necessary resources, rather than the class being instantiated
* within the session in the context of a single managed repository's resolution needs.
*
* @plexus.component role="org.apache.archiva.metadata.repository.storage.RepositoryStorage" role-hint="maven2"
* plexus.component role="org.apache.archiva.metadata.repository.storage.RepositoryStorage" role-hint="maven2"
*/
public class Maven2RepositoryStorage
implements RepositoryStorage
@ -75,22 +79,31 @@ public class Maven2RepositoryStorage
/**
* @plexus.requirement
*/
private ModelBuilder builder;
private ModelBuilder builders;
/**
* @plexus.requirement
* plexus.requirement
*/
@Inject @Named(value = "archivaConfiguration#default")
private ArchivaConfiguration archivaConfiguration;
/**
* @plexus.requirement role-hint="maven2"
* plexus.requirement role-hint="maven2"
*/
@Inject @Named(value = "repositoryPathTranslator#maven2")
private RepositoryPathTranslator pathTranslator;
private final static Logger log = LoggerFactory.getLogger( Maven2RepositoryStorage.class );
private static final String METADATA_FILENAME = "maven-metadata.xml";
@PostConstruct
public void initialize()
{
//
ou ou
}
public ProjectMetadata readProjectMetadata( String repoId, String namespace, String projectId )
{
// TODO: could natively implement the "shared model" concept from the browse action to avoid needing it there?

View File

@ -0,0 +1,33 @@
<?xml version="1.0"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="true">
<context:annotation-config/>
<context:component-scan base-package="org.apache.archiva.dependency.tree.maven2,org.apache.archiva.metadata.repository.storage.maven2"/>
</beans>

View File

@ -60,11 +60,6 @@
<artifactId>commons-logging-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>

View File

@ -45,10 +45,6 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>

View File

@ -44,11 +44,6 @@
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-consumer-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>

View File

@ -37,11 +37,6 @@
<groupId>org.apache.archiva</groupId>
<artifactId>maven2-repository</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>

View File

@ -16,12 +16,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>

43
pom.xml
View File

@ -77,9 +77,7 @@
<exclude>org.codehaus.plexus:plexus-log4j-logging</exclude>
<exclude>org.codehaus.plexus:plexus-spring</exclude>
<!--
<exclude>org.codehaus.redback:plexus-spring</exclude>
-->
<exclude>commons-logging:commons-logging</exclude>
<exclude>org.slf4j:jcl104-over-slf4j</exclude>
<exclude>velocity:velocity-dep</exclude>
@ -89,6 +87,8 @@
<exclude>ant:ant-optional</exclude>
<exclude>xom:xom</exclude>
<exclude>org.codehaus.plexus:plexus-xwork-integration</exclude>
<exclude>org.codehaus.plexus:plexus-component-api</exclude>
<exclude>org.codehaus.plexus:plexus-container-default</exclude>
<exclude>plexus:plexus-utils</exclude>
<exclude>com.google.code.atinject:atinject</exclude>
<exclude>org.codehaus.plexus.cache:plexus-cache-api</exclude>
@ -249,7 +249,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
@ -267,6 +266,12 @@
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>httpunit</groupId>
<artifactId>httpunit</artifactId>
@ -558,17 +563,24 @@
<artifactId>spring-utils</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!--
use this layer as some modules need to use maven apis
until we find a better solution
-->
<dependency>
<groupId>org.codehaus.redback.components</groupId>
<artifactId>plexus-spring</artifactId>
<version>1.3-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</exclusion>
</exclusions>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-plexus</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-guice</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax</artifactId>
@ -720,11 +732,6 @@
<artifactId>maven-model-builder</artifactId>
<version>${maven3x.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
<version>1.0-alpha-22</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-digest</artifactId>
@ -1268,7 +1275,7 @@
<properties>
<struts.version>2.1.8.1</struts.version>
<maven.version>2.0.8</maven.version>
<maven3x.version>3.0-alpha-4</maven3x.version>
<maven3x.version>3.0.3</maven3x.version>
<wagon.version>1.0-beta-5</wagon.version>
<redback.version>1.3-SNAPSHOT</redback.version>
<jetty.version>6.1.19</jetty.version>