diff options
author | Olivier Lamy <olamy@apache.org> | 2011-05-26 20:52:13 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2011-05-26 20:52:13 +0000 |
commit | 1788eb54c492ac4a0f3efd6d4d504fd8fc55d26c (patch) | |
tree | 6f6ff2e608639c0ff425ade6c7516a7858f30507 | |
parent | 16714e5e4dc72fa81589ebe23a4cbe49f57be462 (diff) | |
download | archiva-1788eb54c492ac4a0f3efd6d4d504fd8fc55d26c.tar.gz archiva-1788eb54c492ac4a0f3efd6d4d504fd8fc55d26c.zip |
[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
32 files changed, 247 insertions, 204 deletions
diff --git a/archiva-cli/pom.xml b/archiva-cli/pom.xml index d022b557d..207b43da6 100644 --- a/archiva-cli/pom.xml +++ b/archiva-cli/pom.xml @@ -34,12 +34,6 @@ </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> <scope>runtime</scope> </dependency> @@ -65,10 +59,6 @@ <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> </dependency> diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml index 8a7d0dff6..2c18c5eff 100644 --- a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml +++ b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml @@ -34,11 +34,6 @@ <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> </dependency> diff --git a/archiva-modules/archiva-base/archiva-common/pom.xml b/archiva-modules/archiva-base/archiva-common/pom.xml index 0702c84f3..f669b6db1 100644 --- a/archiva-modules/archiva-base/archiva-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-common/pom.xml @@ -47,20 +47,16 @@ <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> <version>1.6.1</version> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml index cebe075c5..e55626aaf 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml @@ -55,15 +55,16 @@ <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> <scope>test</scope> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml index 7a5e7daba..1cf58da2c 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml @@ -51,10 +51,6 @@ <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> </dependency> @@ -75,11 +71,6 @@ <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> <scope>test</scope> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml index 35599fd92..4858f900e 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml @@ -54,10 +54,6 @@ <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> </dependency> diff --git a/archiva-modules/archiva-base/archiva-converter/pom.xml b/archiva-modules/archiva-base/archiva-converter/pom.xml index 5b7b25266..0552ef742 100644 --- a/archiva-modules/archiva-base/archiva-converter/pom.xml +++ b/archiva-modules/archiva-base/archiva-converter/pom.xml @@ -49,11 +49,6 @@ <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> <scope>test</scope> diff --git a/archiva-modules/archiva-base/archiva-indexer/pom.xml b/archiva-modules/archiva-base/archiva-indexer/pom.xml index 5f2c63ec1..cb1af1db9 100644 --- a/archiva-modules/archiva-base/archiva-indexer/pom.xml +++ b/archiva-modules/archiva-base/archiva-indexer/pom.xml @@ -41,17 +41,18 @@ <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> </dependency> <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> diff --git a/archiva-modules/archiva-base/archiva-model/pom.xml b/archiva-modules/archiva-base/archiva-model/pom.xml index 86a785106..1d8201102 100755 --- a/archiva-modules/archiva-base/archiva-model/pom.xml +++ b/archiva-modules/archiva-base/archiva-model/pom.xml @@ -41,11 +41,6 @@ <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> <scope>test</scope> diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml index b3063dbe7..da1b41ff5 100644 --- a/archiva-modules/archiva-base/archiva-proxy/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml @@ -29,11 +29,6 @@ <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> </dependency> @@ -65,10 +60,12 @@ <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-digest</artifactId> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-component-api</artifactId> + <exclusions> + <exclusion> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-api</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.codehaus.redback.components.registry</groupId> diff --git a/archiva-modules/archiva-base/archiva-transaction/pom.xml b/archiva-modules/archiva-base/archiva-transaction/pom.xml index b76c4d92c..2de639c52 100644 --- a/archiva-modules/archiva-base/archiva-transaction/pom.xml +++ b/archiva-modules/archiva-base/archiva-transaction/pom.xml @@ -35,21 +35,18 @@ <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> <scope>test</scope> diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml index 115617def..52547cc20 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml @@ -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> diff --git a/archiva-modules/archiva-web/archiva-rss/pom.xml b/archiva-modules/archiva-web/archiva-rss/pom.xml index 29ed58c6a..a5827b2fc 100644 --- a/archiva-modules/archiva-web/archiva-rss/pom.xml +++ b/archiva-modules/archiva-web/archiva-rss/pom.xml @@ -29,11 +29,6 @@ <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> </dependency> diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index 30ca4fa82..d05f6eb55 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -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> diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml index 4cab22d8c..0fe5f7858 100644 --- a/archiva-modules/archiva-web/archiva-webdav/pom.xml +++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml @@ -81,10 +81,6 @@ <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> </dependency> diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/pom.xml index 6ac1dcb23..1faa656d3 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/pom.xml +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/pom.xml @@ -51,17 +51,10 @@ <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> diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml index 3385f3952..4669f3104 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml @@ -80,11 +80,6 @@ <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> <scope>test</scope> diff --git a/archiva-modules/metadata/metadata-repository-api/pom.xml b/archiva-modules/metadata/metadata-repository-api/pom.xml index f93c46365..30e4ef8b8 100644 --- a/archiva-modules/metadata/metadata-repository-api/pom.xml +++ b/archiva-modules/metadata/metadata-repository-api/pom.xml @@ -27,6 +27,14 @@ <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> </dependency> @@ -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> diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java index 08115b1cb..903cbf199 100644 --- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java +++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java @@ -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() ) diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/resources/META-INF/spring-context.xml b/archiva-modules/metadata/metadata-repository-api/src/main/resources/META-INF/spring-context.xml new file mode 100644 index 000000000..6e1dc2489 --- /dev/null +++ b/archiva-modules/metadata/metadata-repository-api/src/main/resources/META-INF/spring-context.xml @@ -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>
\ No newline at end of file diff --git a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java index 2d9c87bd7..9d45c8ded 100644 --- a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java +++ b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java @@ -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"; diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml index f8ad19a28..07ced4f9e 100644 --- a/archiva-modules/plugins/maven2-repository/pom.xml +++ b/archiva-modules/plugins/maven2-repository/pom.xml @@ -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> diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/DefaultArtifactMappingProvider.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/DefaultArtifactMappingProvider.java index d5e0add7e..bc08d8a96 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/DefaultArtifactMappingProvider.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/DefaultArtifactMappingProvider.java @@ -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 { diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryPathTranslator.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryPathTranslator.java index 26982c48b..4ed4c0825 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryPathTranslator.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryPathTranslator.java @@ -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 ) + "'" ); } } diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java index c4d51c0b4..223db1ffb 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java @@ -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? diff --git a/archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/spring-context.xml b/archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/spring-context.xml new file mode 100644 index 000000000..039160b3a --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/spring-context.xml @@ -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>
\ No newline at end of file diff --git a/archiva-modules/plugins/metadata-store-file/pom.xml b/archiva-modules/plugins/metadata-store-file/pom.xml index c2bd09fa0..00556ffbc 100644 --- a/archiva-modules/plugins/metadata-store-file/pom.xml +++ b/archiva-modules/plugins/metadata-store-file/pom.xml @@ -61,11 +61,6 @@ <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> <scope>test</scope> diff --git a/archiva-modules/plugins/metadata-store-jcr/pom.xml b/archiva-modules/plugins/metadata-store-jcr/pom.xml index 967e3e261..60bb6752b 100644 --- a/archiva-modules/plugins/metadata-store-jcr/pom.xml +++ b/archiva-modules/plugins/metadata-store-jcr/pom.xml @@ -46,10 +46,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.codehaus.redback.components</groupId> - <artifactId>plexus-spring</artifactId> - </dependency> - <dependency> <groupId>javax.jcr</groupId> <artifactId>jcr</artifactId> </dependency> diff --git a/archiva-modules/plugins/problem-reports/pom.xml b/archiva-modules/plugins/problem-reports/pom.xml index 0264068d1..948c35915 100644 --- a/archiva-modules/plugins/problem-reports/pom.xml +++ b/archiva-modules/plugins/problem-reports/pom.xml @@ -45,11 +45,6 @@ <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> <scope>test</scope> diff --git a/archiva-modules/plugins/repository-statistics/pom.xml b/archiva-modules/plugins/repository-statistics/pom.xml index 776777def..7a3115a41 100644 --- a/archiva-modules/plugins/repository-statistics/pom.xml +++ b/archiva-modules/plugins/repository-statistics/pom.xml @@ -38,11 +38,6 @@ <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> </dependency> diff --git a/archiva-modules/plugins/stage-repository-merge/pom.xml b/archiva-modules/plugins/stage-repository-merge/pom.xml index ccab04763..42c952d2b 100644 --- a/archiva-modules/plugins/stage-repository-merge/pom.xml +++ b/archiva-modules/plugins/stage-repository-merge/pom.xml @@ -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> @@ -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> @@ -268,6 +267,12 @@ <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> <version>1.6.2</version> @@ -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> @@ -722,11 +734,6 @@ </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> <version>1.1</version> </dependency> @@ -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> |