ArchivaConfiguration archivaConfiguration;
@Inject
- protected PlexusSisuBridge plexusSisuBridge;
+ protected NexusIndexer nexusIndexer;
@Before
public void tearDown()
throws Exception
{
- NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
{
nexusIndexer.removeIndexingContext( indexingContext, false );
protected ApplicationContext applicationContext;
@Inject
- protected PlexusSisuBridge plexusSisuBridge;
+ protected NexusIndexer nexusIndexer;
@Before
protected void removeMavenIndexes()
throws Exception
{
- NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
{
nexusIndexer.removeIndexingContext( indexingContext, false );
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
+ <classifier>shaded-lucene</classifier>
<exclusions>
<exclusion>
<groupId>org.apache.lucene</groupId>
public NexusIndexerConsumer(
@Named( value = "archivaTaskScheduler#indexing" ) ArchivaTaskScheduler<ArtifactIndexingTask> scheduler,
@Named( value = "archivaConfiguration" ) ArchivaConfiguration configuration, FileTypes filetypes,
- PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils,
- ManagedRepositoryAdmin managedRepositoryAdmin )
- throws PlexusSisuBridgeException
+ MavenIndexerUtils mavenIndexerUtils,
+ ManagedRepositoryAdmin managedRepositoryAdmin, NexusIndexer nexusIndexer )
{
this.configuration = configuration;
this.filetypes = filetypes;
this.scheduler = scheduler;
- this.nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
+ this.nexusIndexer = nexusIndexer;
this.allIndexCreators = mavenIndexerUtils.getAllIndexCreators();
this.managedRepositoryAdmin = managedRepositoryAdmin;
}
<artifactId>spring-context-support</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-queries</artifactId>
- </dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven.indexer</groupId>
+ <artifactId>indexer-reader</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
+ <classifier>shaded-lucene</classifier>
<exclusions>
<exclusion>
<groupId>org.apache.lucene</groupId>
*/
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.time.StopWatch;
private List<String> runningGroups = new CopyOnWriteArrayList<String>();
@Inject
- public DefaultIndexMerger( PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils )
+ public DefaultIndexMerger( NexusIndexer nexusIndexer, IndexPacker indexPacker, MavenIndexerUtils mavenIndexerUtils )
throws PlexusSisuBridgeException
{
- this.indexer = plexusSisuBridge.lookup( NexusIndexer.class );
+ this.indexer = nexusIndexer;
this.mavenIndexerUtils = mavenIndexerUtils;
- indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" );
+ this.indexPacker = indexPacker;
}
@Override
if ( indexMergerRequest.isPackIndex() )
{
- IndexPackingRequest request = new IndexPackingRequest( indexingContext, indexLocation );
+ IndexPackingRequest request = new IndexPackingRequest( indexingContext, //
+ indexingContext.acquireIndexSearcher().getIndexReader(), //
+ indexLocation );
indexPacker.packIndex( request );
}
private NexusIndexer indexer;
@Inject
- public TemporaryGroupIndexCleaner( PlexusSisuBridge plexusSisuBridge )
+ public TemporaryGroupIndexCleaner( NexusIndexer nexusIndexer )
throws PlexusSisuBridgeException
{
- indexer = plexusSisuBridge.lookup( NexusIndexer.class );
+ this.indexer = nexusIndexer;
}
// 900000
public void cleanTemporaryIndex()
{
- for ( TemporaryGroupIndex temporaryGroupIndex : indexMerger.getTemporaryGroupIndexes() )
- {
- // cleanup files older than the ttl
- if ( new Date().getTime() - temporaryGroupIndex.getCreationTime() > temporaryGroupIndex.getMergedIndexTtl() )
- {
- log.info( "cleanTemporaryIndex for groupId {}", temporaryGroupIndex.getGroupId() );
- indexMerger.cleanTemporaryGroupIndex( temporaryGroupIndex );
+ indexMerger.getTemporaryGroupIndexes()
+ .stream()
+ .forEach( temporaryGroupIndex ->
+ {
+ // cleanup files older than the ttl
+ if ( new Date().getTime() - temporaryGroupIndex.getCreationTime() >
+ temporaryGroupIndex.getMergedIndexTtl() )
+ {
+ log.info( "cleanTemporaryIndex for groupId {}", temporaryGroupIndex.getGroupId() );
+ indexMerger.cleanTemporaryGroupIndex( temporaryGroupIndex );
- }
- }
+ }
+ }
+ );
}
}
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
import org.apache.archiva.indexer.util.SearchUtil;
import org.apache.commons.lang.StringUtils;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.search.BooleanClause;
-import org.apache.lucene.search.BooleanClause.Occur;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.Query;
+
import org.apache.maven.index.ArtifactInfo;
import org.apache.maven.index.FlatSearchRequest;
import org.apache.maven.index.FlatSearchResponse;
import org.apache.maven.index.expr.SearchTyped;
import org.apache.maven.index.expr.SourcedSearchExpression;
import org.apache.maven.index.expr.UserInputSearchExpression;
+import org.apache.maven.index.shaded.lucene.search.BooleanClause;
+import org.apache.maven.index.shaded.lucene.search.BooleanClause.Occur;
+import org.apache.maven.index.shaded.lucene.search.BooleanQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
}
@Inject
- public MavenRepositorySearch( PlexusSisuBridge plexusSisuBridge, ManagedRepositoryAdmin managedRepositoryAdmin,
- MavenIndexerUtils mavenIndexerUtils, ProxyConnectorAdmin proxyConnectorAdmin )
+ public MavenRepositorySearch( NexusIndexer nexusIndexer, ManagedRepositoryAdmin managedRepositoryAdmin,
+ MavenIndexerUtils mavenIndexerUtils, ProxyConnectorAdmin proxyConnectorAdmin,
+ QueryCreator queryCreator)
throws PlexusSisuBridgeException
{
- this.indexer = plexusSisuBridge.lookup( NexusIndexer.class );
- this.queryCreator = plexusSisuBridge.lookup( QueryCreator.class );
+ this.indexer = nexusIndexer;
+ this.queryCreator = queryCreator;
this.managedRepositoryAdmin = managedRepositoryAdmin;
this.mavenIndexerUtils = mavenIndexerUtils;
this.proxyConnectorAdmin = proxyConnectorAdmin;
BooleanQuery iQuery = new BooleanQuery();
constructQuery( previousTerm, iQuery );
- q.add( iQuery, Occur.MUST );
+ q.add( iQuery, BooleanClause.Occur.MUST );
}
BooleanQuery iQuery = new BooleanQuery();
constructQuery( term, iQuery );
- q.add( iQuery, Occur.MUST );
+ q.add( iQuery, BooleanClause.Occur.MUST );
}
// we retun only artifacts without classifier in quick search, olamy cannot find a way to say with this field empty
q.add( indexer.constructQuery( MAVEN.GROUP_ID, searchFields.isExactSearch()
? new SourcedSearchExpression( searchFields.getGroupId() )
: new UserInputSearchExpression( searchFields.getGroupId() )
- ), Occur.MUST
+ ), BooleanClause.Occur.MUST
);
}
searchFields.isExactSearch()
? new SourcedSearchExpression( searchFields.getArtifactId() )
: new UserInputSearchExpression( searchFields.getArtifactId() )
- ), Occur.MUST
+ ), BooleanClause.Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getVersion() ) )
{
q.add( indexer.constructQuery( MAVEN.VERSION, searchFields.isExactSearch() ? new SourcedSearchExpression(
- searchFields.getVersion() ) : new SourcedSearchExpression( searchFields.getVersion() ) ), Occur.MUST );
+ searchFields.getVersion() ) : new SourcedSearchExpression( searchFields.getVersion() ) ), BooleanClause.Occur.MUST );
}
if ( StringUtils.isNotBlank( searchFields.getPackaging() ) )
{
q.add( indexer.constructQuery( MAVEN.PACKAGING, searchFields.isExactSearch() ? new SourcedSearchExpression(
searchFields.getPackaging() ) : new UserInputSearchExpression( searchFields.getPackaging() ) ),
- Occur.MUST
+ BooleanClause.Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getClassName() ) )
{
q.add( indexer.constructQuery( MAVEN.CLASSNAMES,
- new UserInputSearchExpression( searchFields.getClassName() ) ), Occur.MUST );
+ new UserInputSearchExpression( searchFields.getClassName() ) ), BooleanClause.Occur.MUST );
}
if ( StringUtils.isNotBlank( searchFields.getBundleSymbolicName() ) )
{
q.add( indexer.constructQuery( OSGI.SYMBOLIC_NAME,
new UserInputSearchExpression( searchFields.getBundleSymbolicName() ) ),
- Occur.MUST
+ BooleanClause.Occur.MUST
);
}
{
q.add( indexer.constructQuery( OSGI.VERSION,
new UserInputSearchExpression( searchFields.getBundleVersion() ) ),
- Occur.MUST
+ BooleanClause.Occur.MUST
);
}
for ( ArtifactInfo artifactInfo : artifactInfos )
{
- if ( StringUtils.equalsIgnoreCase( "pom", artifactInfo.fextension ) && !includePoms )
+ if ( StringUtils.equalsIgnoreCase( "pom", artifactInfo.getFileExtension() ) && !includePoms )
{
continue;
}
- String id = SearchUtil.getHitId( artifactInfo.groupId, artifactInfo.artifactId, artifactInfo.classifier,
- artifactInfo.packaging );
+ String id = SearchUtil.getHitId( artifactInfo.getGroupId(), //
+ artifactInfo.getArtifactId(), //
+ artifactInfo.getClassifier(), //
+ artifactInfo.getPackaging() );
Map<String, SearchResultHit> hitsMap = results.getHitsMap();
if ( !applyArtifactInfoFilters( artifactInfo, artifactInfoFilters, hitsMap ) )
SearchResultHit hit = hitsMap.get( id );
if ( hit != null )
{
- if ( !hit.getVersions().contains( artifactInfo.version ) )
+ if ( !hit.getVersions().contains( artifactInfo.getVersion() ) )
{
- hit.addVersion( artifactInfo.version );
+ hit.addVersion( artifactInfo.getVersion() );
}
}
else
{
hit = new SearchResultHit();
- hit.setArtifactId( artifactInfo.artifactId );
- hit.setGroupId( artifactInfo.groupId );
- hit.setRepositoryId( artifactInfo.repository );
- hit.addVersion( artifactInfo.version );
- hit.setBundleExportPackage( artifactInfo.bundleExportPackage );
- hit.setBundleExportService( artifactInfo.bundleExportService );
- hit.setBundleSymbolicName( artifactInfo.bundleSymbolicName );
- hit.setBundleVersion( artifactInfo.bundleVersion );
- hit.setBundleDescription( artifactInfo.bundleDescription );
- hit.setBundleDocUrl( artifactInfo.bundleDocUrl );
- hit.setBundleRequireBundle( artifactInfo.bundleRequireBundle );
- hit.setBundleImportPackage( artifactInfo.bundleImportPackage );
- hit.setBundleLicense( artifactInfo.bundleLicense );
- hit.setBundleName( artifactInfo.bundleName );
- hit.setContext( artifactInfo.context );
- hit.setGoals( artifactInfo.goals );
- hit.setPrefix( artifactInfo.prefix );
- hit.setPackaging( artifactInfo.packaging );
- hit.setClassifier( artifactInfo.classifier );
- hit.setFileExtension( artifactInfo.fextension );
+ hit.setArtifactId( artifactInfo.getArtifactId() );
+ hit.setGroupId( artifactInfo.getGroupId() );
+ hit.setRepositoryId( artifactInfo.getRepository() );
+ hit.addVersion( artifactInfo.getVersion() );
+ hit.setBundleExportPackage( artifactInfo.getBundleExportPackage() );
+ hit.setBundleExportService( artifactInfo.getBundleExportService() );
+ hit.setBundleSymbolicName( artifactInfo.getBundleSymbolicName() );
+ hit.setBundleVersion( artifactInfo.getBundleVersion() );
+ hit.setBundleDescription( artifactInfo.getBundleDescription() );
+ hit.setBundleDocUrl( artifactInfo.getBundleDocUrl() );
+ hit.setBundleRequireBundle( artifactInfo.getBundleRequireBundle() );
+ hit.setBundleImportPackage( artifactInfo.getBundleImportPackage() );
+ hit.setBundleLicense( artifactInfo.getBundleLicense() );
+ hit.setBundleName( artifactInfo.getBundleName() );
+ hit.setContext( artifactInfo.getContext() );
+ hit.setGoals( artifactInfo.getGoals() );
+ hit.setPrefix( artifactInfo.getPrefix() );
+ hit.setPackaging( artifactInfo.getPackaging() );
+ hit.setClassifier( artifactInfo.getClassifier() );
+ hit.setFileExtension( artifactInfo.getFileExtension() );
hit.setUrl( getBaseUrl( artifactInfo, selectedRepos ) );
}
throws RepositoryAdminException
{
StringBuilder sb = new StringBuilder();
- if ( StringUtils.startsWith( artifactInfo.context, "remote-" ) )
+ if ( StringUtils.startsWith( artifactInfo.getContext(), "remote-" ) )
{
// it's a remote index result we search a managed which proxying this remote and on which
// current user has read karma
String managedRepoId =
- getManagedRepoId( StringUtils.substringAfter( artifactInfo.context, "remote-" ), selectedRepos );
+ getManagedRepoId( StringUtils.substringAfter( artifactInfo.getContext(), "remote-" ), selectedRepos );
if ( managedRepoId != null )
{
sb.append( '/' ).append( managedRepoId );
- artifactInfo.context = managedRepoId;
+ artifactInfo.setContext( managedRepoId );
}
}
else
{
- sb.append( '/' ).append( artifactInfo.context );
+ sb.append( '/' ).append( artifactInfo.getContext() );
}
- sb.append( '/' ).append( StringUtils.replaceChars( artifactInfo.groupId, '.', '/' ) );
- sb.append( '/' ).append( artifactInfo.artifactId );
- sb.append( '/' ).append( artifactInfo.version );
- sb.append( '/' ).append( artifactInfo.artifactId );
- sb.append( '-' ).append( artifactInfo.version );
- if ( StringUtils.isNotBlank( artifactInfo.classifier ) )
+ sb.append( '/' ).append( StringUtils.replaceChars( artifactInfo.getGroupId(), '.', '/' ) );
+ sb.append( '/' ).append( artifactInfo.getArtifactId() );
+ sb.append( '/' ).append( artifactInfo.getVersion() );
+ sb.append( '/' ).append( artifactInfo.getArtifactId() );
+ sb.append( '-' ).append( artifactInfo.getVersion() );
+ if ( StringUtils.isNotBlank( artifactInfo.getClassifier() ) )
{
- sb.append( '-' ).append( artifactInfo.classifier );
+ sb.append( '-' ).append( artifactInfo.getClassifier() );
}
// maven-plugin packaging is a jar
- if ( StringUtils.equals( "maven-plugin", artifactInfo.packaging ) )
+ if ( StringUtils.equals( "maven-plugin", artifactInfo.getPackaging() ) )
{
sb.append( "jar" );
}
else
{
- sb.append( '.' ).append( artifactInfo.packaging );
+ sb.append( '.' ).append( artifactInfo.getPackaging() );
}
return sb.toString();
@Override
public boolean addArtifactInResult( ArtifactInfo artifact, Map<String, SearchResultHit> currentResult )
{
- return StringUtils.isBlank( artifact.classifier );
+ return StringUtils.isBlank( artifact.getClassifier() );
}
}
import org.apache.maven.index.ArtifactContextProducer;
import org.apache.maven.index.ArtifactScanningListener;
import org.apache.maven.index.NexusIndexer;
+import org.apache.maven.index.QueryCreator;
import org.apache.maven.index.ScanningResult;
import org.apache.maven.index.context.IndexingContext;
import org.easymock.EasyMock;
ArchivaConfiguration archivaConfig;
+ @Inject
ArtifactContextProducer artifactContextProducer;
IMocksControl archivaConfigControl;
@Inject
MavenIndexerUtils mavenIndexerUtils;
+ @Inject
NexusIndexer nexusIndexer;
+ @Inject
+ QueryCreator queryCreator;
+
@Before
@Override
public void setUp()
DefaultProxyConnectorAdmin defaultProxyConnectorAdmin = new DefaultProxyConnectorAdmin();
defaultProxyConnectorAdmin.setArchivaConfiguration( archivaConfig );
- search = new MavenRepositorySearch( plexusSisuBridge, defaultManagedRepositoryAdmin, mavenIndexerUtils,
- defaultProxyConnectorAdmin );
-
- nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
-
- artifactContextProducer = plexusSisuBridge.lookup( ArtifactContextProducer.class );
+ search = new MavenRepositorySearch( nexusIndexer, defaultManagedRepositoryAdmin, mavenIndexerUtils,
+ defaultProxyConnectorAdmin, queryCreator );
defaultManagedRepositoryAdmin.setMavenIndexerUtils( mavenIndexerUtils );
defaultManagedRepositoryAdmin.setIndexer( nexusIndexer );
search.getAllIndexCreators() );
// minimize datas in memory
- context.getIndexWriter().setMaxBufferedDocs( -1 );
- context.getIndexWriter().setRAMBufferSizeMB( 1 );
+// context.getIndexWriter().setMaxBufferedDocs( -1 );
+// context.getIndexWriter().setRAMBufferSizeMB( 1 );
for ( File artifactFile : filesToBeIndexed )
{
assertTrue( "file not exists " + artifactFile.getPath(), artifactFile.exists() );
if ( artifactFile.getPath().endsWith( ".pom" ) )
{
- ac.getArtifactInfo().fextension = "pom";
- ac.getArtifactInfo().packaging = "pom";
- ac.getArtifactInfo().classifier = "pom";
+ ac.getArtifactInfo().setFileExtension( "pom" );
+ ac.getArtifactInfo().setPackaging( "pom" );
+ ac.getArtifactInfo().setClassifier( "pom" );
}
nexusIndexer.addArtifactToIndex( ac, context );
context.updateTimestamp( true );
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-queryparser</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-analyzers-common</artifactId>
- </exclusion>
- </exclusions>
+ <classifier>shaded-lucene</classifier>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
import org.apache.maven.index.context.IndexCreator;
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.List;
+import java.util.Map;
/**
* @author Olivier Lamy
private Logger log = LoggerFactory.getLogger( getClass() );
- @Inject
private List<? extends IndexCreator> allIndexCreators;
- public MavenIndexerUtils()
+ private ApplicationContext applicationContext;
+
+ @Inject
+ public MavenIndexerUtils(ApplicationContext applicationContext, Map<String, IndexCreator> indexers)
{
+ this.applicationContext = applicationContext;
+ }
+
+ @PostConstruct
+ public void initialize()
+ {
+ allIndexCreators = new ArrayList<>( applicationContext.getBeansOfType( IndexCreator.class ).values());
+
if ( allIndexCreators == null || allIndexCreators.isEmpty() )
{
throw new RuntimeException( "cannot initiliaze IndexCreators" );
<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"
+ xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd"
- default-lazy-init="true">
+ http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd"
+ default-lazy-init="true">
<context:annotation-config/>
- <context:component-scan base-package="org.apache.archiva.common.plexusbridge,org.apache.maven.index"/>
+ <context:component-scan base-package="org.apache.archiva.common.plexusbridge
+ org.apache.maven.index"/>
+
+ <!--
+ <bean id="indexer" class="org.apache.maven.index.DefaultIndexer"/>
+ <bean id="scanner" class="org.apache.maven.index.DefaultScanner"/>
+ <bean id="indexerEngine" class="org.apache.maven.index.DefaultIndexerEngine"/>
+ <bean id="searchEngine" class="org.apache.maven.index.DefaultSearchEngine"/>
+ <bean id="queryCreator" class="org.apache.maven.index.DefaultQueryCreator"/>
+ <bean id="artifactContextProducer" class="org.apache.maven.index.DefaultArtifactContextProducer"/>
+ <bean id="artifactPackagingMapper" class="org.apache.maven.index.artifact.DefaultArtifactPackagingMapper"/>
+ -->
+
+ <!-- Index creators:
+ <bean id="minimalArtifactInfoIndexCreator" class="org.apache.maven.index.creator.MinimalArtifactInfoIndexCreator"/>
+ <bean id="jarFileContentsIndexCreator" class="org.apache.maven.index.creator.JarFileContentsIndexCreator"/>
+ <bean id="mavenPluginArtifactInfoIndexCreator" class="org.apache.maven.index.creator.MavenPluginArtifactInfoIndexCreator"/>
+ -->
+ <!-- Index creators.
+
+ <util:map id="indexers"
+ key-type="java.lang.String"
+ value-type="org.apache.maven.index.context.IndexCreator"
+ map-class="java.util.LinkedHashMap">
+ <entry key="min" value-ref="minimalArtifactInfoIndexCreator"/>
+ <entry key="jarContent" value-ref="jarFileContentsIndexCreator"/>
+ <entry key="maven-plugin" value-ref="mavenPluginArtifactInfoIndexCreator"/>
+ </util:map>
+ -->
</beans>
\ No newline at end of file
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/beans/spring-beans.xsd
http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+ http://www.springframework.org/schema/context/spring-context.xsd"
default-lazy-init="true">
<context:annotation-config/>
<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"
+ http://www.springframework.org/schema/beans/spring-beans.xsd"
default-lazy-init="true">
<bean name="wagon#file" scope="prototype" class="org.apache.maven.wagon.providers.file.FileWagon"/>
protected ManagedRepositoryAdmin managedRepositoryAdmin;
@Inject
- protected PlexusSisuBridge plexusSisuBridge;
+ protected NexusIndexer nexusIndexer;
@Before
public void setUp()
protected void removeMavenIndexes()
throws Exception
{
- NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
{
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
+ <classifier>shaded-lucene</classifier>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
+ <classifier>shaded-lucene</classifier>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
@Inject
private RepositoryStatisticsManager repositoryStatisticsManager;
- @Inject
- private PlexusSisuBridge plexusSisuBridge;
-
@Inject
private MavenIndexerUtils mavenIndexerUtils;
try
{
- NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
-
- IndexingContext context = nexusIndexer.getIndexingContexts().get( repository.getId() );
+ IndexingContext context = indexer.getIndexingContexts().get( repository.getId() );
if ( context != null )
{
// delete content only if directory exists
- nexusIndexer.removeIndexingContext( context,
+ indexer.removeIndexingContext( context,
deleteContent && context.getIndexDirectoryFile().exists() );
}
}
- catch ( PlexusSisuBridgeException e )
- {
- throw new RepositoryAdminException( e.getMessage(), e );
- }
catch ( IOException e )
{
throw new RepositoryAdminException( e.getMessage(), e );
this.repositoryTaskScheduler = repositoryTaskScheduler;
}
- public PlexusSisuBridge getPlexusSisuBridge()
- {
- return plexusSisuBridge;
- }
-
- public void setPlexusSisuBridge( PlexusSisuBridge plexusSisuBridge )
- {
- this.plexusSisuBridge = plexusSisuBridge;
- }
-
public MavenIndexerUtils getMavenIndexerUtils()
{
return mavenIndexerUtils;
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/beans/spring-beans.xsd
http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true">
-
+ http://www.springframework.org/schema/context/spring-context.xsd"
+ default-lazy-init="true">
<context:annotation-config />
- <context:component-scan
- base-package="org.apache.archiva.admin.repository"/>
+ <context:component-scan base-package="org.apache.archiva.admin.repository"/>
<alias name="redbackRuntimeConfigurationAdmin#default" alias="userConfiguration#archiva"/>
-->
<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" xmlns:tx="http://www.springframework.org/schema/tx"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
+ http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/tx
+ http://www.springframework.org/schema/tx/spring-tx.xsd"
default-lazy-init="true">
<context:annotation-config/>
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-queryparser</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-analyzers-common</artifactId>
- </exclusion>
- </exclusions>
+ <classifier>shaded-lucene</classifier>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
import org.apache.archiva.redback.components.taskqueue.Task;
import org.apache.archiva.redback.components.taskqueue.execution.TaskExecutionException;
import org.apache.archiva.redback.components.taskqueue.execution.TaskExecutor;
-import org.apache.lucene.search.BooleanClause;
-import org.apache.lucene.search.BooleanQuery;
import org.apache.maven.index.ArtifactContext;
import org.apache.maven.index.ArtifactContextProducer;
import org.apache.maven.index.FlatSearchRequest;
import org.apache.maven.index.expr.SourcedSearchExpression;
import org.apache.maven.index.packer.IndexPacker;
import org.apache.maven.index.packer.IndexPackingRequest;
+import org.apache.maven.index.shaded.lucene.search.BooleanClause;
+import org.apache.maven.index.shaded.lucene.search.BooleanQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
-import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
{
private Logger log = LoggerFactory.getLogger( ArchivaIndexingTaskExecutor.class );
+ @Inject
private IndexPacker indexPacker;
- private ArtifactContextProducer artifactContextProducer;
-
@Inject
- private PlexusSisuBridge plexusSisuBridge;
+ private ArtifactContextProducer artifactContextProducer;
@Inject
private ManagedRepositoryAdmin managedRepositoryAdmin;
+ @Inject
private NexusIndexer nexusIndexer;
- @PostConstruct
- public void initialize()
- throws PlexusSisuBridgeException
- {
- log.info( "Initialized {}", this.getClass().getName() );
-
- artifactContextProducer = plexusSisuBridge.lookup( ArtifactContextProducer.class );
-
- indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" );
-
- nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
-
- }
/**
* depending on current {@link Task} you have.
// TODO make that configurable?
if ( artifactFile.getPath().endsWith( ".pom" ) )
{
- ac.getArtifactInfo().fextension = "pom";
- ac.getArtifactInfo().packaging = "pom";
- ac.getArtifactInfo().classifier = "pom";
+ ac.getArtifactInfo().setFileExtension( "pom" );
+ ac.getArtifactInfo().setPackaging( "pom" );
+ ac.getArtifactInfo().setClassifier( "pom" );
}
if ( indexingTask.getAction().equals( ArtifactIndexingTask.Action.ADD ) )
{
BooleanQuery q = new BooleanQuery();
q.add( nexusIndexer.constructQuery( MAVEN.GROUP_ID, new SourcedSearchExpression(
- ac.getArtifactInfo().groupId ) ), BooleanClause.Occur.MUST );
+ ac.getArtifactInfo().getGroupId() ) ), BooleanClause.Occur.MUST );
q.add( nexusIndexer.constructQuery( MAVEN.ARTIFACT_ID, new SourcedSearchExpression(
- ac.getArtifactInfo().artifactId ) ), BooleanClause.Occur.MUST );
+ ac.getArtifactInfo().getArtifactId() ) ), BooleanClause.Occur.MUST );
q.add( nexusIndexer.constructQuery( MAVEN.VERSION, new SourcedSearchExpression(
- ac.getArtifactInfo().version ) ), BooleanClause.Occur.MUST );
- if ( ac.getArtifactInfo().classifier != null )
+ ac.getArtifactInfo().getVersion() ) ), BooleanClause.Occur.MUST );
+ if ( ac.getArtifactInfo().getClassifier() != null )
{
q.add( nexusIndexer.constructQuery( MAVEN.CLASSIFIER, new SourcedSearchExpression(
- ac.getArtifactInfo().classifier ) ), BooleanClause.Occur.MUST );
+ ac.getArtifactInfo().getClassifier() ) ), BooleanClause.Occur.MUST );
}
- if ( ac.getArtifactInfo().packaging != null )
+ if ( ac.getArtifactInfo().getPackaging() != null )
{
q.add( nexusIndexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression(
- ac.getArtifactInfo().packaging ) ), BooleanClause.Occur.MUST );
+ ac.getArtifactInfo().getPackaging() ) ), BooleanClause.Occur.MUST );
}
FlatSearchRequest flatSearchRequest = new FlatSearchRequest( q, context );
FlatSearchResponse flatSearchResponse = nexusIndexer.searchFlat( flatSearchRequest );
this.indexPacker = indexPacker;
}
- public PlexusSisuBridge getPlexusSisuBridge()
- {
- return plexusSisuBridge;
- }
-
- public void setPlexusSisuBridge( PlexusSisuBridge plexusSisuBridge )
- {
- this.plexusSisuBridge = plexusSisuBridge;
- }
}
Logger log = LoggerFactory.getLogger( getClass() );
@Inject
- private PlexusSisuBridge plexusSisuBridge;
+ private NexusIndexer nexusIndexer;
@PreDestroy
public void shutdown()
{
log.info( "cleanup IndexingContext" );
- NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
for ( IndexingContext context : nexusIndexer.getIndexingContexts().values() )
{
nexusIndexer.removeIndexingContext( context, true );
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
+ <classifier>shaded-lucene</classifier>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<slf4j.version>1.7.25</slf4j.version>
<log4j.version>2.8.2</log4j.version>
- <spring.version>4.3.8.RELEASE</spring.version>
+ <spring.version>4.3.9.RELEASE</spring.version>
<javax.jcr.version>2.0</javax.jcr.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<artifactId>archiva-indexer</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven.indexer</groupId>
+ <artifactId>indexer-reader</artifactId>
+ <version>${maven.indexer.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
<version>${maven.indexer.version}</version>
+ <classifier>shaded-lucene</classifier>
<exclusions>
+ <exclusion>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>