diff options
author | olivier lamy <olamy@apache.org> | 2017-06-24 09:33:50 +1000 |
---|---|---|
committer | olivier lamy <olamy@apache.org> | 2017-06-24 09:33:50 +1000 |
commit | 0bfead8264c924e832a9672f85516e0bf69c5cd8 (patch) | |
tree | 14918b5ff18e9f2c1833785fb4738dd672127d37 /archiva-modules/archiva-base/archiva-plexus-bridge | |
parent | ddbb6cdaf499915affabe440ab4c0da1fc482202 (diff) | |
download | archiva-0bfead8264c924e832a9672f85516e0bf69c5cd8.tar.gz archiva-0bfead8264c924e832a9672f85516e0bf69c5cd8.zip |
some progress on new indexer
Signed-off-by: olivier lamy <olamy@apache.org>
Diffstat (limited to 'archiva-modules/archiva-base/archiva-plexus-bridge')
2 files changed, 4 insertions, 29 deletions
diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java index 448851ee7..dc94ad5fe 100644 --- a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java +++ b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java @@ -20,18 +20,11 @@ package org.apache.archiva.common.plexusbridge; */ import org.apache.maven.index.context.IndexCreator; -import org.apache.maven.index.creator.JarFileContentsIndexCreator; -import org.apache.maven.index.creator.MavenArchetypeArtifactInfoIndexCreator; -import org.apache.maven.index.creator.MavenPluginArtifactInfoIndexCreator; -import org.apache.maven.index.creator.MinimalArtifactInfoIndexCreator; -import org.apache.maven.index.creator.OsgiArtifactIndexCreator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import javax.inject.Inject; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** @@ -44,32 +37,14 @@ public class MavenIndexerUtils private Logger log = LoggerFactory.getLogger( getClass() ); + @Inject private List<? extends IndexCreator> allIndexCreators; - @Inject - public MavenIndexerUtils( PlexusSisuBridge plexusSisuBridge ) - throws PlexusSisuBridgeException + public MavenIndexerUtils() { - allIndexCreators = new ArrayList( plexusSisuBridge.lookupList( IndexCreator.class ) ); - - if ( allIndexCreators == null || allIndexCreators.isEmpty() ) - { - // olamy when the TCL is not a URLClassLoader lookupList fail ! - // when using tomcat maven plugin so adding a simple hack - log.warn( "using lookupList from sisu plexus failed so build indexCreator manually" ); - - allIndexCreators = - Arrays.asList( plexusSisuBridge.lookup( IndexCreator.class, OsgiArtifactIndexCreator.ID ), - plexusSisuBridge.lookup( IndexCreator.class, MavenArchetypeArtifactInfoIndexCreator.ID ), - plexusSisuBridge.lookup( IndexCreator.class, MinimalArtifactInfoIndexCreator.ID ), - plexusSisuBridge.lookup( IndexCreator.class, JarFileContentsIndexCreator.ID ), - plexusSisuBridge.lookup( IndexCreator.class, MavenPluginArtifactInfoIndexCreator.ID ) ); - - } - if ( allIndexCreators == null || allIndexCreators.isEmpty() ) { - throw new PlexusSisuBridgeException( "no way to initiliaze IndexCreator" ); + throw new RuntimeException( "cannot initiliaze IndexCreators" ); } log.debug( "allIndexCreators {}", allIndexCreators ); diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml index 41188dcd8..cd6acffd9 100644 --- a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml @@ -28,5 +28,5 @@ default-lazy-init="true"> <context:annotation-config/> - <context:component-scan base-package="org.apache.archiva.common.plexusbridge"/> + <context:component-scan base-package="org.apache.archiva.common.plexusbridge,org.apache.maven.index"/> </beans>
\ No newline at end of file |