diff options
author | olivier lamy <olamy@apache.org> | 2017-08-19 21:37:35 +1000 |
---|---|---|
committer | olivier lamy <olamy@apache.org> | 2017-08-19 21:37:35 +1000 |
commit | 7a2710ec0a566f44a1f135b71176addfdd7047e7 (patch) | |
tree | 48886c9c6e6d66035093df4c6bbb866b83253ead /archiva-modules/archiva-base | |
parent | f93a787e74f048fd4fe393819c09d898da63b4f4 (diff) | |
parent | 88385088993b8121099f48371ce9e00689ccb547 (diff) | |
download | archiva-7a2710ec0a566f44a1f135b71176addfdd7047e7.tar.gz archiva-7a2710ec0a566f44a1f135b71176addfdd7047e7.zip |
Merge branch 'feature/jcr_oak'
Diffstat (limited to 'archiva-modules/archiva-base')
50 files changed, 349 insertions, 684 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml index f8af4626c..bb331e01e 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml @@ -86,6 +86,26 @@ <version>1.9</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-core</artifactId> + <version>5.5.4</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-highlighter</artifactId> + <version>5.5.4</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-memory</artifactId> + <version>5.5.4</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-queries</artifactId> + <version>5.5.4</version> + </dependency> <!-- for some reasons this help sonar to run --> <dependency> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java index 1176bc59c..715dc684c 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java @@ -56,7 +56,7 @@ public abstract class AbstractArtifactConsumerTest ArchivaConfiguration archivaConfiguration; @Inject - protected PlexusSisuBridge plexusSisuBridge; + protected NexusIndexer nexusIndexer; @Before @@ -75,7 +75,6 @@ public abstract class AbstractArtifactConsumerTest public void tearDown() throws Exception { - NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() ) { nexusIndexer.removeIndexingContext( indexingContext, false ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java index 1a997eea7..b1bd0c50d 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java @@ -98,7 +98,7 @@ public abstract class AbstractRepositoryPurgeTest protected ApplicationContext applicationContext; @Inject - protected PlexusSisuBridge plexusSisuBridge; + protected NexusIndexer nexusIndexer; @Before @@ -132,7 +132,6 @@ public abstract class AbstractRepositoryPurgeTest protected void removeMavenIndexes() throws Exception { - NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() ) { nexusIndexer.removeIndexingContext( indexingContext, false ); 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 6eed0b863..208825140 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 @@ -66,10 +66,31 @@ <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</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> </dependency> <dependency> <groupId>org.apache.maven.indexer</groupId> <artifactId>indexer-core</artifactId> + <classifier>shaded-lucene</classifier> + <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> </dependency> <dependency> <groupId>javax.inject</groupId> @@ -111,21 +132,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.apache.jackrabbit</groupId> - <artifactId>jackrabbit-core</artifactId> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <scope>test</scope> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java index 66f067f34..8399af0bc 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java @@ -22,9 +22,6 @@ package org.apache.archiva.consumers.lucene; 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.MavenIndexerUtils; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.ConfigurationNames; import org.apache.archiva.configuration.FileTypes; @@ -32,13 +29,13 @@ import org.apache.archiva.consumers.AbstractMonitoredConsumer; import org.apache.archiva.consumers.ConsumerException; import org.apache.archiva.consumers.KnownRepositoryContentConsumer; import org.apache.archiva.redback.components.registry.Registry; +import org.apache.archiva.redback.components.registry.RegistryListener; +import org.apache.archiva.redback.components.taskqueue.TaskQueueException; import org.apache.archiva.scheduler.ArchivaTaskScheduler; import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexCreator; import org.apache.maven.index.context.IndexingContext; -import org.apache.archiva.redback.components.registry.RegistryListener; -import org.apache.archiva.redback.components.taskqueue.TaskQueueException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Scope; @@ -88,15 +85,13 @@ public class NexusIndexerConsumer public NexusIndexerConsumer( @Named( value = "archivaTaskScheduler#indexing" ) ArchivaTaskScheduler<ArtifactIndexingTask> scheduler, @Named( value = "archivaConfiguration" ) ArchivaConfiguration configuration, FileTypes filetypes, - PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils, - ManagedRepositoryAdmin managedRepositoryAdmin ) - throws PlexusSisuBridgeException + List<IndexCreator> indexCreators, ManagedRepositoryAdmin managedRepositoryAdmin, NexusIndexer nexusIndexer ) { this.configuration = configuration; this.filetypes = filetypes; this.scheduler = scheduler; - this.nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); - this.allIndexCreators = mavenIndexerUtils.getAllIndexCreators(); + this.nexusIndexer = nexusIndexer; + this.allIndexCreators = indexCreators; this.managedRepositoryAdmin = managedRepositoryAdmin; } diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java index 5ce2781cd..91d0c107c 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java @@ -22,14 +22,15 @@ package org.apache.archiva.consumers.lucene; import junit.framework.TestCase; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; -import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.FileTypes; +import org.apache.archiva.redback.components.taskqueue.TaskQueueException; import org.apache.archiva.scheduler.ArchivaTaskScheduler; import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask; +import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.io.FileUtils; -import org.apache.archiva.redback.components.taskqueue.TaskQueueException; +import org.apache.maven.index.NexusIndexer; +import org.apache.maven.index.context.IndexCreator; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -45,7 +46,6 @@ import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; -import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; /** * NexusIndexerConsumerTest @@ -58,7 +58,7 @@ public class NexusIndexerConsumerTest private final class ArchivaTaskSchedulerStub implements ArchivaTaskScheduler<ArtifactIndexingTask> { - Set<File> indexed = new HashSet<File>(); + Set<File> indexed = new HashSet<>(); @Override public void queueTask( ArtifactIndexingTask task ) @@ -96,10 +96,10 @@ public class NexusIndexerConsumerTest private ApplicationContext applicationContext; @Inject - private PlexusSisuBridge plexusSisuBridge; + private NexusIndexer nexusIndexer; @Inject - private MavenIndexerUtils mavenIndexerUtils; + private List<IndexCreator> indexCreators; @Inject private ManagedRepositoryAdmin managedRepositoryAdmin; @@ -119,11 +119,11 @@ public class NexusIndexerConsumerTest FileTypes filetypes = applicationContext.getBean( FileTypes.class ); nexusIndexerConsumer = - new NexusIndexerConsumer( scheduler, configuration, filetypes, plexusSisuBridge, mavenIndexerUtils, - managedRepositoryAdmin ); + new NexusIndexerConsumer( scheduler, configuration, filetypes, indexCreators, + managedRepositoryAdmin, nexusIndexer ); // initialize to set the file types to be processed - ( (NexusIndexerConsumer) nexusIndexerConsumer ).initialize(); + nexusIndexerConsumer.initialize(); repositoryConfig = new ManagedRepository(); repositoryConfig.setId( "test-repo" ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/spring-context.xml index db01db735..a89137295 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/spring-context.xml @@ -59,6 +59,7 @@ <alias name="roleManager#test" alias="roleManager"/> + <!-- <bean id="jcr-config" class="org.apache.archiva.metadata.repository.jcr.ArchivaJcrRepositoryConfig" factory-method="create"> <constructor-arg value="${appserver.base}/conf/repository.xml"/> <constructor-arg value="${appserver.base}/data/jcr"/> @@ -67,7 +68,7 @@ <bean id="jcr-repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown" lazy-init="true"> <constructor-arg ref="jcr-config"/> </bean> - + --> </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-filelock/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-base/archiva-filelock/src/test/resources/log4j2-test.xml index 93e519df7..f915e53b0 100644 --- a/archiva-modules/archiva-base/archiva-filelock/src/test/resources/log4j2-test.xml +++ b/archiva-modules/archiva-base/archiva-filelock/src/test/resources/log4j2-test.xml @@ -16,25 +16,15 @@ ~ KIND, either express or implied. See the License for the ~ specific language governing permissions and limitations ~ under the License. - --> - - +--> <configuration status="debug"> - - - <appenders> <Console name="console" target="SYSTEM_OUT"> - <!--PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/--> <PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n}" /> </Console> - </appenders> <loggers> - - - <logger name="org.apache.archiva.common.filelock" level="debug"/> - + <logger name="org.apache.archiva.common.filelock" level="info"/> <root level="info" includeLocation="true"> <appender-ref ref="console"/> </root> diff --git a/archiva-modules/archiva-base/archiva-indexer/pom.xml b/archiva-modules/archiva-base/archiva-indexer/pom.xml index 5695593b7..a9f24ef0e 100644 --- a/archiva-modules/archiva-base/archiva-indexer/pom.xml +++ b/archiva-modules/archiva-base/archiva-indexer/pom.xml @@ -49,14 +49,6 @@ </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> </dependency> @@ -84,7 +76,22 @@ </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> + <artifactId>lucene-queryparser</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-analyzers-common</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.eclipse.sisu</groupId> diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java index 225cc78e8..de9342c74 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java @@ -18,12 +18,10 @@ package org.apache.archiva.indexer.merger; * under the License. */ -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; import org.apache.maven.index.NexusIndexer; +import org.apache.maven.index.context.IndexCreator; import org.apache.maven.index.context.IndexingContext; import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException; import org.apache.maven.index.packer.IndexPacker; @@ -51,23 +49,22 @@ public class DefaultIndexMerger private Logger log = LoggerFactory.getLogger( getClass() ); - private MavenIndexerUtils mavenIndexerUtils; + private final NexusIndexer indexer; - private NexusIndexer indexer; + private final IndexPacker indexPacker; - private IndexPacker indexPacker; + private final List<IndexCreator> indexCreators; private List<TemporaryGroupIndex> temporaryGroupIndexes = new CopyOnWriteArrayList<>(); - private List<String> runningGroups = new CopyOnWriteArrayList<String>(); + private List<String> runningGroups = new CopyOnWriteArrayList<>(); @Inject - public DefaultIndexMerger( PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils ) - throws PlexusSisuBridgeException + public DefaultIndexMerger( NexusIndexer nexusIndexer, IndexPacker indexPacker, List<IndexCreator> indexCreators ) { - this.indexer = plexusSisuBridge.lookup( NexusIndexer.class ); - this.mavenIndexerUtils = mavenIndexerUtils; - indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" ); + this.indexer = nexusIndexer; + this.indexPacker = indexPacker; + this.indexCreators = indexCreators; } @Override @@ -97,7 +94,7 @@ public class DefaultIndexMerger File indexLocation = new File( mergedIndexDirectory, indexMergerRequest.getMergedIndexPath() ); IndexingContext indexingContext = indexer.addIndexingContext( tempRepoId, tempRepoId, mergedIndexDirectory, indexLocation, null, null, - mavenIndexerUtils.getAllIndexCreators() ); + indexCreators ); for ( String repoId : indexMergerRequest.getRepositoriesIds() ) { @@ -112,7 +109,9 @@ public class DefaultIndexMerger if ( indexMergerRequest.isPackIndex() ) { - IndexPackingRequest request = new IndexPackingRequest( indexingContext, indexLocation ); + IndexPackingRequest request = new IndexPackingRequest( indexingContext, // + indexingContext.acquireIndexSearcher().getIndexReader(), // + indexLocation ); indexPacker.packIndex( request ); } @@ -126,11 +125,7 @@ public class DefaultIndexMerger stopWatch.getTime() ); return indexingContext; } - catch ( IOException e ) - { - throw new IndexMergerException( e.getMessage(), e ); - } - catch ( UnsupportedExistingLuceneIndexException e ) + catch ( IOException | UnsupportedExistingLuceneIndexException e ) { throw new IndexMergerException( e.getMessage(), e ); } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java index 322d82e06..dc7f5c03a 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java @@ -44,10 +44,10 @@ public class TemporaryGroupIndexCleaner private NexusIndexer indexer; @Inject - public TemporaryGroupIndexCleaner( PlexusSisuBridge plexusSisuBridge ) + public TemporaryGroupIndexCleaner( NexusIndexer nexusIndexer ) throws PlexusSisuBridgeException { - indexer = plexusSisuBridge.lookup( NexusIndexer.class ); + this.indexer = nexusIndexer; } // 900000 @@ -55,15 +55,19 @@ public class TemporaryGroupIndexCleaner 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 ); - } - } + } + } + ); } } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java index 848ca78c1..0e4101648 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java @@ -24,16 +24,9 @@ import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.admin.model.beans.ProxyConnector; 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; @@ -42,12 +35,14 @@ import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.OSGI; import org.apache.maven.index.QueryCreator; import org.apache.maven.index.SearchType; -import org.apache.maven.index.context.IndexCreator; import org.apache.maven.index.context.IndexingContext; import org.apache.maven.index.expr.SearchExpression; 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; @@ -79,22 +74,19 @@ public class MavenRepositorySearch private ProxyConnectorAdmin proxyConnectorAdmin; - private MavenIndexerUtils mavenIndexerUtils; - protected MavenRepositorySearch() { // for test purpose } @Inject - public MavenRepositorySearch( PlexusSisuBridge plexusSisuBridge, ManagedRepositoryAdmin managedRepositoryAdmin, - MavenIndexerUtils mavenIndexerUtils, ProxyConnectorAdmin proxyConnectorAdmin ) + public MavenRepositorySearch( NexusIndexer nexusIndexer, ManagedRepositoryAdmin managedRepositoryAdmin, + 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; } @@ -124,12 +116,12 @@ public class MavenRepositorySearch 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 @@ -163,11 +155,9 @@ public class MavenRepositorySearch BooleanQuery q = new BooleanQuery(); if ( StringUtils.isNotBlank( searchFields.getGroupId() ) ) { - q.add( indexer.constructQuery( MAVEN.GROUP_ID, searchFields.isExactSearch() - ? new SourcedSearchExpression( searchFields.getGroupId() ) - : new UserInputSearchExpression( searchFields.getGroupId() ) - ), Occur.MUST - ); + q.add( indexer.constructQuery( MAVEN.GROUP_ID, searchFields.isExactSearch() ? new SourcedSearchExpression( + searchFields.getGroupId() ) : new UserInputSearchExpression( searchFields.getGroupId() ) ), + BooleanClause.Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getArtifactId() ) ) @@ -175,69 +165,64 @@ public class MavenRepositorySearch q.add( indexer.constructQuery( MAVEN.ARTIFACT_ID, searchFields.isExactSearch() ? new SourcedSearchExpression( searchFields.getArtifactId() ) - : new UserInputSearchExpression( searchFields.getArtifactId() ) - ), Occur.MUST - ); + : new UserInputSearchExpression( searchFields.getArtifactId() ) ), + 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 ); } if ( StringUtils.isNotBlank( searchFields.getBundleVersion() ) ) { q.add( indexer.constructQuery( OSGI.VERSION, new UserInputSearchExpression( searchFields.getBundleVersion() ) ), - Occur.MUST - ); + BooleanClause.Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getBundleExportPackage() ) ) { q.add( indexer.constructQuery( OSGI.EXPORT_PACKAGE, new UserInputSearchExpression( searchFields.getBundleExportPackage() ) ), - Occur.MUST - ); + Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getBundleExportService() ) ) { q.add( indexer.constructQuery( OSGI.EXPORT_SERVICE, new UserInputSearchExpression( searchFields.getBundleExportService() ) ), - Occur.MUST - ); + Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getBundleImportPackage() ) ) { q.add( indexer.constructQuery( OSGI.IMPORT_PACKAGE, new UserInputSearchExpression( searchFields.getBundleImportPackage() ) ), - Occur.MUST - ); + Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getBundleName() ) ) @@ -250,24 +235,21 @@ public class MavenRepositorySearch { q.add( indexer.constructQuery( OSGI.IMPORT_PACKAGE, new UserInputSearchExpression( searchFields.getBundleImportPackage() ) ), - Occur.MUST - ); + Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getBundleRequireBundle() ) ) { q.add( indexer.constructQuery( OSGI.REQUIRE_BUNDLE, new UserInputSearchExpression( searchFields.getBundleRequireBundle() ) ), - Occur.MUST - ); + Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getClassifier() ) ) { q.add( indexer.constructQuery( MAVEN.CLASSIFIER, searchFields.isExactSearch() ? new SourcedSearchExpression( searchFields.getClassifier() ) : new UserInputSearchExpression( searchFields.getClassifier() ) ), - Occur.MUST - ); + Occur.MUST ); } else if ( searchFields.isExactSearch() ) { @@ -284,7 +266,8 @@ public class MavenRepositorySearch searchFields.getRepositories(), searchFields.isIncludePomArtifacts() ); } - private static class NullSearch implements SearchTyped, SearchExpression + private static class NullSearch + implements SearchTyped, SearchExpression { private static final NullSearch INSTANCE = new NullSearch(); @@ -477,13 +460,6 @@ public class MavenRepositorySearch } - - protected List<? extends IndexCreator> getAllIndexCreators() - { - return mavenIndexerUtils.getAllIndexCreators(); - } - - private SearchResults convertToSearchResults( FlatSearchResponse response, SearchResultLimits limits, List<? extends ArtifactInfoFilter> artifactInfoFilters, List<String> selectedRepos, boolean includePoms ) @@ -494,12 +470,14 @@ public class MavenRepositorySearch 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 ) ) @@ -510,34 +488,34 @@ public class MavenRepositorySearch 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 ) ); } @@ -569,40 +547,40 @@ public class MavenRepositorySearch 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(); diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java index 6068aa720..49feb2d81 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java @@ -38,6 +38,6 @@ public class NoClassifierArtifactInfoFilter @Override public boolean addArtifactInResult( ArtifactInfo artifact, Map<String, SearchResultHit> currentResult ) { - return StringUtils.isBlank( artifact.classifier ); + return StringUtils.isBlank( artifact.getClassifier() ); } } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java index 461a4d76b..e3b96f043 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java @@ -22,7 +22,6 @@ package org.apache.archiva.indexer.search; import junit.framework.TestCase; import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; import org.apache.archiva.admin.repository.proxyconnector.DefaultProxyConnectorAdmin; -import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.common.utils.FileUtil; import org.apache.archiva.configuration.ArchivaConfiguration; @@ -35,7 +34,9 @@ import org.apache.maven.index.ArtifactContext; 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.IndexCreator; import org.apache.maven.index.context.IndexingContext; import org.easymock.EasyMock; import org.easymock.IMocksControl; @@ -72,6 +73,7 @@ public abstract class AbstractMavenRepositorySearch ArchivaConfiguration archivaConfig; + @Inject ArtifactContextProducer artifactContextProducer; IMocksControl archivaConfigControl; @@ -82,10 +84,14 @@ public abstract class AbstractMavenRepositorySearch PlexusSisuBridge plexusSisuBridge; @Inject - MavenIndexerUtils mavenIndexerUtils; + List<IndexCreator> indexCreators; + @Inject NexusIndexer nexusIndexer; + @Inject + QueryCreator queryCreator; + @Before @Override public void setUp() @@ -99,7 +105,7 @@ public abstract class AbstractMavenRepositorySearch FileUtils.deleteDirectory( new File( FileUtil.getBasedir(), "/target/repos/" + TEST_REPO_2 + "/.indexer" ) ); assertFalse( new File( FileUtil.getBasedir(), "/target/repos/" + TEST_REPO_2 + "/.indexer" ).exists() ); - archivaConfigControl = EasyMock.createControl( ); + archivaConfigControl = EasyMock.createControl(); archivaConfig = archivaConfigControl.createMock( ArchivaConfiguration.class ); @@ -109,16 +115,11 @@ public abstract class AbstractMavenRepositorySearch DefaultProxyConnectorAdmin defaultProxyConnectorAdmin = new DefaultProxyConnectorAdmin(); defaultProxyConnectorAdmin.setArchivaConfiguration( archivaConfig ); - search = new MavenRepositorySearch( plexusSisuBridge, defaultManagedRepositoryAdmin, mavenIndexerUtils, - defaultProxyConnectorAdmin ); + search = new MavenRepositorySearch( nexusIndexer, defaultManagedRepositoryAdmin, defaultProxyConnectorAdmin, + queryCreator ); - nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); - - artifactContextProducer = plexusSisuBridge.lookup( ArtifactContextProducer.class ); - - defaultManagedRepositoryAdmin.setMavenIndexerUtils( mavenIndexerUtils ); defaultManagedRepositoryAdmin.setIndexer( nexusIndexer ); - defaultManagedRepositoryAdmin.setIndexCreators( mavenIndexerUtils.getAllIndexCreators() ); + defaultManagedRepositoryAdmin.setIndexCreators( indexCreators ); config = new Configuration(); config.addManagedRepository( createRepositoryConfig( TEST_REPO_1 ) ); @@ -201,12 +202,11 @@ public abstract class AbstractMavenRepositorySearch context = nexusIndexer.addIndexingContext( repository, repository, repo, indexDirectory, repo.toURI().toURL().toExternalForm(), - indexDirectory.toURI().toURL().toString(), - search.getAllIndexCreators() ); + indexDirectory.toURI().toURL().toString(), indexCreators ); // 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() ); @@ -214,9 +214,9 @@ public abstract class AbstractMavenRepositorySearch 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 ); @@ -240,13 +240,13 @@ public abstract class AbstractMavenRepositorySearch @Override public void scanningStarted( IndexingContext ctx ) { - + // } @Override public void scanningFinished( IndexingContext ctx, ScanningResult result ) { - + // no op } @Override @@ -258,7 +258,9 @@ public abstract class AbstractMavenRepositorySearch @Override public void artifactDiscovered( ArtifactContext ac ) { - log.debug( "artifactDiscovered {}:{}", ac.getArtifact().getPath(), ac.getArtifactInfo() ); + log.debug( "artifactDiscovered {}:{}", // + ac.getArtifact() == null ? "" : ac.getArtifact().getPath(), // + ac.getArtifact() == null ? "" : ac.getArtifactInfo() ); } } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java index 4b0d993ef..6d4f6acab 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java @@ -22,6 +22,7 @@ package org.apache.archiva.indexer.search; import org.apache.archiva.common.utils.FileUtil; import org.apache.archiva.indexer.util.SearchUtil; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; +import org.apache.maven.index_shaded.lucene.index.IndexUpgrader; import org.codehaus.plexus.util.FileUtils; import org.easymock.EasyMock; import org.junit.Test; @@ -29,10 +30,7 @@ import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import java.io.File; -import java.nio.file.Files; -import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -40,8 +38,8 @@ import java.util.Collections; import java.util.List; -@RunWith(ArchivaSpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" }) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) +@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public class MavenRepositorySearchTest extends AbstractMavenRepositorySearch { @@ -290,13 +288,13 @@ public class MavenRepositorySearchTest archivaConfigControl.replay(); - SearchResults results = search.search( "user", selectedRepos, "org", limits, Collections.<String>emptyList() ); + SearchResults results = search.search( "user", selectedRepos, "org", limits, Collections.emptyList() ); archivaConfigControl.verify(); assertNotNull( results ); assertEquals( 1, results.getHits().size() ); - assertEquals( "total hits not 8 for page1 " + results, 8, results.getTotalHits() ); + assertEquals( "total hits not 9 for page1 " + results, 9, results.getTotalHits() ); assertEquals( "returned hits not 1 for page1 " + results, 1, results.getReturnedHitsCount() ); assertEquals( limits, results.getLimits() ); @@ -317,7 +315,7 @@ public class MavenRepositorySearchTest assertNotNull( results ); assertEquals( "hits not 1", 1, results.getHits().size() ); - assertEquals( "total hits not 8 for page 2 " + results, 8, results.getTotalHits() ); + assertEquals( "total hits not 9 for page 2 " + results, 9, results.getTotalHits() ); assertEquals( "returned hits not 1 for page2 " + results, 1, results.getReturnedHitsCount() ); assertEquals( limits, results.getLimits() ); } @@ -873,11 +871,13 @@ public class MavenRepositorySearchTest File indexDirectory = new File( repo, ".index" ); FileUtils.copyDirectoryStructure( new File( "src/test/repo-release" ), repo ); - createIndex( "repo-release", Collections.<File>emptyList(), false ); + IndexUpgrader.main( new String[]{ indexDirectory.getAbsolutePath() } ); + + createIndex( "repo-release", Collections.emptyList(), false ); nexusIndexer.addIndexingContext( REPO_RELEASE, REPO_RELEASE, repo, indexDirectory, repo.toURI().toURL().toExternalForm(), - indexDirectory.toURI().toURL().toString(), search.getAllIndexCreators() ); + indexDirectory.toURI().toURL().toString(), indexCreators ); SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES ); limits.setPageSize( 300 ); @@ -886,8 +886,9 @@ public class MavenRepositorySearchTest archivaConfigControl.replay(); - SearchResults searchResults = search.search( null, Arrays.asList( REPO_RELEASE ), "org.example", limits, - Collections.<String>emptyList() ); + SearchResults searchResults = search.search( null, Arrays.asList( REPO_RELEASE ), // + "org.example", limits, // + Collections.emptyList() ); log.info( "results: {}", searchResults.getHits().size() ); diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fdt b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fdt Binary files differdeleted file mode 100644 index 9c708cae2..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fdt +++ /dev/null diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fdx b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fdx Binary files differdeleted file mode 100644 index 9c6ebd91b..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fdx +++ /dev/null diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fnm b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fnm deleted file mode 100644 index b57e72100..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fnm +++ /dev/null @@ -1,5 +0,0 @@ -þÿÿÿ -DESCRIPTORIDXINFOumigavgroupId -artifactIdversionp1c -classnamesBundle-SymbolicNameBundle-VersionExport-PackageExport-ServiceBundle-NameImport-PackageRequire-Bundle -rootGroupsrootGroupsList allGroups
allGroupsList
\ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.frq b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.frq deleted file mode 100644 index d966170eb..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.frq +++ /dev/null @@ -1,262 +0,0 @@ -‡‹Y·%…5¥ÕõÙ‰ÃÕyq‘Ù•ãu•W£
…µù˧åÁ硽«¥£©õݹÃIñűµÓïû•å¡íãᣗÉ_óŸŸ›…#ës›§¯×ëŸû§¿³ÿÑ·Ñ+½‰Õljõý—¿‹1?©·¥—÷Çí;w奱‡ëÕ¯ñ…ͳūíßÓÝóÁ‡i§ƒgÉ‘K!µ)Í›ÉÇíU¿ýÿÇ—Óé÷ÿ•§çõÝ×AÉ3¯±Ïû»½¯'ý{·«“ÙË㩛뙓óù£‰¹“‘Ë9÷ùý±…ß“™£¡¥éÿëÏmÛ›·åßÕͽ™íÛ‘Ÿßáቅóïñ×=¹ÇQÏËeɃÁÇû÷±¿•™³ãçï‰û}ñÛëÓãÛÙ›«Á7E¯÷‡ó£éõ½¡µ©©ÅMÏkñͱ絋·Ã¹‹éѳ-“»Ñ³©ŸÅµ»¥Ý/ùÓ‘ÑÍGOááé]—»cËÅùÙ¯o¿ýC«§ÿ׃ïϹ‡×ƒ‘[™Á“ ³Så‹ß‹ç¡—ÝŸ•»Ûƒ™µ‡ ©±1e åK^X¥••™…ù‘1e åK^X¡í çåµß×ÑËÿ·½¯‘§¡™•‘…ùíçáÙÕÓÑÍ™·¯§ŸÉÅÁ½™‰…ýùõñíéåáÝÙÕÑÍÉÅÁ½¹µ±©¡™•‘‰…ýùóëÛϽ “‡¥ õéãáÝ•…{Õɽ±£si_[W¥•OIC;3+#%
7/ 1
3
1u§ %
7
J]9$/@µ‡ ©±1e åK^X¥••™…ù‘1e åK^X¡í çåµß×ÑËÿ·½¯‘§¡™•‘…ùíçáÙÕÓÑ™‰áÃ1“WëÍ™·¯§ŸÉÅÁ½™‰…ýùõñíéåáÝÙÕÑÍÉÅÁ½¹µ±©¡™•‘‰…ýùóëÛϽ “‡¥ õéãáÝ•…{Õɽ±£si_[ËW# 5
'>"7,%%*(¥•OIC;3+# -
AÁ
)
`L
/ +
)
1YO¯
'G?+ (,<½
3 )(( ! !1
7AÇ
9
|æ%
7/ 1
3
1u§
7
9MF$#5:!1
7AÇ
9
|æ%
7/ 1
3
1u§ %
7
J]9$/@µ‡ 9 ±`†t(6àI* P„E
=
9SV*64ç u77â*Šç u77â*Šæt.6âK* P†H¥••™…ù‘sßrÃœ¡'%
_%
=
óeIŒí çsßåµç u77â*Šµß×ÑËÿ·½‘a‡ u17à*ˆ -
<
9-S%V*64rÞ§'1_%=ó{Iª¡™•‘…ùíçÙÕÓç u77â*Š™‰áÃ1“WëÍ'$
_%
=
; ( tlM* `i:ç u77â*Š™·¯§ŸÉÅÁ½™‰…ýùõñíéåáÝÙÕÑÍÉÅÁ½¹µ±©¡™•‘‰…ý
=
9SV*64ùrÞóÛÏ“‡õéãáÝ•…Õɱ£s'1_%
=
ó{Iª
=
#
1BnŒË
=
9SV*64W'1_%
=
ó{Iª
!
3
.%(*$ "#¥•OI;3#
=
9SV*64ç u77â*Š'$
_%
=
ódIŒ -&0^$< :!7!†\*~µ‡ 9 ±
3 )(( ! ¥••™…ù‘¡í çåµß×ÑËÿ·½‘
3« --$(q 1§¡™•‘…ùíçÙÕÓ
3 )(( ! Í™·¯§ŸÉÅÁ½ç u75Ô X™‰…ýùõñíéåáÝÙÕÑÍÉÅÁ½¹µ±©¡™•‘‰…ý
3 )(( ! ùóÛÏ“‡õéãáÝ•…Õɱ£s
3 )(( !
3 )(( ! W
3 )(( ! ¥•OI;3#æ## ###t64Ô« ùX ü1e 9(&4>h0 PL - -1e - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -9( - - - - - -& - -4 - - - - - - - - - ->!h0’ ¢PLŽ1e 9(&4>h0r €PdLráç u75Ô X¢
Yæt64Ôx €X €¦
=
9SV* 64Ÿ qW÷™Vö˜Ý
§§W÷™£ç u77â* Š §§'1_%
=
!!†N 'XVöZ8¦§¦
F - - - - - - - - -
4 - -
c
4 - -
d %m#•/ ¶ À!††%ê"
3 )(( ! W÷™§¦¦¦¦§0>rÚ ">1¹2§§Vö˜§§§§Vö˜1 ?
sç!
u
¹! ?
s#!
!
z\ 6Z"¦W÷™ç u15Ô X ¦W÷[9§Þ§W÷™§ç u/5Ô X§§1 ?
sÛ
!
#?
1¹× -<
95S H ƒ ª' •1 J< yW÷[?¦Í™ßVçq(W÷™1e åC ^XW÷[?¦VöZ01 ?
sÛ
!
"?
1¹1 ?
sÚ
!
""
0 ¹W÷[?0>rÏ "R¹-¦
>r 4 1 zc^$ P2F.§IË $ 9A
1)
„!W÷[?W÷[?½VöZ>0>rË 9<¹<Vö˜W÷™W÷[?͙ߦVöZ8§1e åK^X¦W÷Z?W÷™¦VËZ -§ « ! /!!,$r!4W÷™§VöZ>PW÷[?§ - - - - - ,( - -! - -!9!(,d8$V1"./9+:W÷™§§ßy
7?1 ?
sç!
#S
1¹§W÷™§§W÷™µÌ˜§W÷™
=
9S.V * 6!4$ -<94S :V >* @6 84 =1 ?
sç!
[
¹V -ö -Z> -¦W÷[?¦W÷[?Í™§¦§W÷[?0"rÛ #+€-ÞW÷™µ1e 6
Y=K^XVöZ9§W÷™Q§W÷Z?Í™¦s´+W0>ræ t0
¹.1 ?
sÚ
!
#>
1¹¦¡ ) !ùˆ§ç u /7â* ˆ´¦9§¦Í™D£ A)Ò %oW÷™Vö˜§§§§½¦Ž¦0W÷Z?W÷™¦9W÷Z9Q¦0>rG„ "#0¹J0>rF• a¹<§Wö[>Qñ§žpD‡ 4A+)ÑV"J7W÷™§§§§¦1 ?
sç!
"S
0¹WÉ k/W÷™
=
9SV* 64&W÷™´§Vö˜§¦W÷™§ - - / - - - - - - - - - - - - - - - - - - - - - - - - - - -& - - - - - -J -& - - - - - - - - - -#v‚C ‚.!j „ ž£t¾ q ˜1 ?
sç!
u
¹´§rÊt1 ?
sç!
u
¹Vö˜W÷™Vö˜W÷[?¦W÷Z?V -ö -˜ -W÷™§¦ ÞW÷[?V†dZ>W÷™W÷™1e åK^Xá¦W÷™Vö˜¦WË[ß1 ?
sç!
#S
¹W÷Z8¦'1_%=; 0 †N BX ¦§¦1§W÷™W÷™sßµ§9ç u17â* ˆ!W÷[?W÷™§¦µ§
! ?
s 4
!
1
z"^ P"H!W÷[?§VÈj.ç u17â* ˆ - - - - - - - - -%+$ $%+#§1 ?
sç!
u
¹W÷[?̘§Vö˜W÷Z?§Vö˜§1 ?
sÛ
!
a
¹áµ´¦ -¦µÞE£ 5A1)Ò VJ§¦¦Ì˜Í™Vö˜¦ŽÌ˜§Vö˜W÷™ )
=
5
?k, =CVöZ(Q1 ?
s
!
"(
0¹§W÷Z?¦Vö˜W÷™§¦W÷[?¦1 -11¿ -111111111120´111Ä%2´11[†)!ð( Ä Š( c' §* å î!!À"!«!Ò ò € - - - - - - -
n - -Ð - n - --¤ Þ%“#Á6J ¡ ²!òô%¦"…§1e (
(=h/* 0'(C+W÷™Í™¦W÷™W÷“Wã•™§
=
9SV*64§§W÷™§¦Vö˜Vö˜§¦§¦æt06â-* 1ˆ 4W÷™§W÷™W÷™Wã•™rÊt§Vö’¦Þ̘¦ŽVöZ>Qצ§µW÷[)§W÷™1 -11¿ -111111111120´111Ä%2´11[†)!ð( Ä Š( c' §* ã î!!À"!«!Ò òµVö[>§§
3 )(( ! µrÊue§VöZ0QW÷™£¦§§µ
=
9SV* 64'µ0>ræ "R0¹.¦
! %@B/9#! $!5B..Í™Vö˜ßVö[>1e
9) '5>h0 PJ$£
]0>rÚ "80¹!§¦§ç u5Ö X Þ - -2 $* &( & &( # 3%%!"µ¦W÷[?Q¦
=
9SH '1:%§Vö˜VöZ>
=
9SV*641 ?
s
!
#(
1¹§¦§'1_%
=
ó{Iª )
I¬
")
0jɧ
=
9S$V* 6 45VöZ>VöZ8
3 )(( ! W÷[91e
9) '7>h: * |W÷Z9W÷Z9ßVö’¦§Vö˜§1 ?
sÚ
!
"8
¹#§W÷Z?Q
<
¬"0Bn'£0§1 ?
sË
!
")
¹ 1 ?
sË!
9=
¹W÷™
=
9SV* 64¦Ž¦W÷™§§×W÷[9Qµ1 ?
s
!
"(
0¹)W÷[?W÷“1e åC ^X¦¦§Vö˜¦Ž - -1e - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -9( - - - - - -& - -4 - - - - - - - - - ->!h0’ ¢PLŽç u15Ô X
=
9SV* 64¦¦W÷™W÷™W÷™Í™§´§ - & '" (+§0>ræ t0 -¹[´1 ?
sç!
u
¹Í[?§¦Vö˜1 ?
sç!
u
¹ , RM0 T W'I [ mUN C hW÷Z -?§§Vö“¦D£ 4A)à!* ‚'W÷™§Vö“¦t1e åK^X -
- - - - - - 9 - - - -%!!/*+ @-!u1e åK^X
Ý'/($/@" - - - -2ô - -6 - -.D8/´æt64Ô X u1e åK^X1e åK^X1e
9)'5>h0 PL
Ý'/($/@#
3õ7/D8/´uu%
5õ
7
/S1°Jutu1e åK^X - - - - - - - - 8 - - - -%.! :/ 3 . ; @+-'1e åK^Xuut -0däJ^X " - - - -2ô - -6 - -.D8/´u -0däJ^-X 0·µ³±¯«©§¥£¡Ÿ›™—•“‘‹…ÿùóíçåãßÛ×ÓÑÏËÇÿ½»·³¯«§£¡Ÿ›™—•“‘‹…ÿùóíçáÛÙ×ÕÓÑÏÍËÉÇÅÃÁ¿½»·³¯«§£Ÿ›™—•“‘‹‰‡…ƒÿýûù÷õóñïíëéçåãáßÝÛÙ×ÕÓÑÏÍËÉÇÅÃÁ¿½»¹·µ³±¯«©§¡›™—•“‘‹‰‡…ƒÿýûù÷óïëçáÛÕÏÉý·±«¥Ÿ™“‡ûõïéãáßÝÛÕÏÉý·±«¥Ÿ›•‹…{wsoica_][YWUOIC=;93-+)#
»³‡ ¯1e åK^X£“
‹“—ÿó1e åK^XŸí çã
! !
,%'+," ( (³ÛÓÏÇÿ³»«‹£Ÿ›—“‹ÿóíçÛ×ÕÓϛˋ›—³«£›Çÿ»—‡ƒ‹ÿû÷óïëçãßÛ×ÓÏËÇÿ»·³«¯§›—“‹‡ƒÿû÷ïçÛÏ·“‡ŸûïéãßÛ›‹…wÏ÷«oca]YU£“OI=9-)#™™••‘‘‰‰×קååáᥥÁWˉýñëÍÅÁ‰ýñë¥åßÙÓ—‘‹…ùí癉ƒÙ͵©SM7'!·‡ûïéáÙÿ¹‡ûïé¹±©¡£õãÝ×Ñ›•‰ƒ÷ëå—‡×˳§uQK5%µ±±©©¡¡™™••‘‘…ùí çåßÑ·½©¡¡™™••‘‘…ùíçÙÕÓÍ·¯§ŸÉŽ™™‰‰……••‘‘ýýùùõõññííééÝÝÙÙÕÕÑÑÍÍÉÉÅÅÁÁ½½¹¹µµ±±©©¡¡……ýýùùóáÛÕÏ™“‡õéãáÝ•…Õɱ¥sOI;3#
3 )(( ! !1
7AÇ
9
|æ%
7/ 1
3
1u§
7
9MF$ #5:!1
7AÇ
9
|æ%
7/ 1
3
1u§ %
7
J]9$ /@´†8°¤”Œ”˜„ø ì -æä´ÞÖÐʾ¶¼Œ¦ œ˜”Œ„øìæØÔÒœ˜ˆàÃ0’WëÌŒœ˜¶®¦žÈÄÀ¼˜ˆ„Œ€üøôðìèäàÜØÔÐÌÈÄÀ¼¸´¬°¨ ˜”Œˆ„€üøòÚÎ’†€ôèâàÜœ”„~ÔÈ°¢rËç u77Ø XV
!
3 .%(*$ "#¤”NH:2"þÿÿ0þÿÿ0þÿÿ0 a
! !
,%'+," ( (¹³·µ¯±«§©£¥Ÿ¡›—™“•‘‹ƒÿ‰‡…÷õóýûùñïíëéçãåÝÛáßÕÓÙ×ÏÑÉÇÍËÅÃÁ¿»½µ³¹·±¯«£¥§©Ÿ¡›—™“•‘‹ƒÿ‰‡…÷õóýûùñïíëéçåãáßÝÛ×ÙÕÓÑÏËÍÇÉÃÅ¿Á»½µ³¹·«±¯¥£©§›¡Ÿ—™“‘•‹‡‰ƒ…ÿûý÷ùóõïñëíçéãåßáÛÝ×ÙÓÕÏÑËÍÇÉÃÅ¿Á»½·¹³µ¯±«§©Ÿ›¥£¡—™“•‘‹‡‰ƒ…ÿûý÷ùñïõóíëéçßÝÛåãáÓÑÏÙ×ÕÍËÉÇÅÃÁ¿½»¹·µ³±¯«©§¥£¡Ÿ—•“›™‹‰‡‘ÿýû…ƒóñïù÷õíëéçåãßáÛÝÓÑÏÙ×ÕÇÅÃÍËÉÁ¿½»¹·¯«µ³±£¡Ÿ©§¥›“‘™—•‹‰‡…ƒ}{ywqousmkigeca_][YUWSQOMKIGECA?=9;1/-753+)'%#!
;»%A80·){%% 1;70tI¥
*(/' diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.nrm b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.nrm deleted file mode 100644 index 6579c2991..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.nrm +++ /dev/null @@ -1 +0,0 @@ -NRMÿ|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy|||xx||||y|y|yyxx||||||yxyyy|||y|yyyxxx||||||y|yxyx|yyyxxxyy||yyxx||||||yxyyy|||y|yyy|||yyy|||yyyxxxyyy|||yyy|||y|y|||||||yyy|||yyy|||yyy|||yyy|||xxxxxxyyyxxxxxxxxxyyyxxxyyy|||yyy|||yyxxyy||y|y|y|y|y|y|y|y|y|yyy|||y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|xyxyxyy|yy||yy||yy||yy||y|y|y|y|y|yx||y|yyyxxx||||||yyy|||yyy|||y|y|y|y|y|y|yy||yyxxyy||y|||||yy||y|yy||yy||y|||||||yyy|||yyy|||xyxyxyxyxyxyxyxyxyy|xyy|||xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyxyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||y|y||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||y|y|y|y|y|y|y|y|y|||y|||y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|||||||||||||||||||||||||||||||||||||||||||||||||||||||||y|y|y|y|y|y||||||||||||||||||||||||||y||||||||||||||||||||||||||y|y|y|y|y|y|y|y|y|y|||||||uvvvv|u|u||||vvvvvv|||||vvv|v||||||vvvvvv|w|||||||||||||vv||||vvvvvv|||||vvv|v|||vvv|||vvv|||||||||vvv|||vvv|v|vvvvvvv|||vvv|||vvvuuuvvvuuuvvv||||||||||||||||||||||||uuuvvvuuuvvv||||||vv|t|t|t|t|u|u|u|u|u|||tvv|t|t|t|t|t|t|t|t|t|t|t|t|t|t|u|u|t|t|t|t|t|t|t|t|t|t|t|t|t||vv||vv||vv||vv|v|w|v|v|v||vv|v||||||vvvvvv|||vvv|||vvv|t|t|t|t|t|t||wv||||||vv|vvvvv||wv|v||uv||vv|vvvvvvv|||vvv|||vvv|t|t|t|t|t|t|t|t|t|t|uu||||wxxxx|y|y||xxxx|xx||x|||xx||x|||xxxxx|xx||y|x|x||||xxx||xx||xxxx|xx||x|||xx||x|||xx||||xx||||xxx|||xx||||xx||x|xxx|xx||||xx||||xx|xxyxx|xxyxx||||xxx|||xxx|||xxx|||xxxxxyxx|xxyxx|||xx||xx|x|x|x|x|y|y|y|y|y|||xx||x|x|x|x|x|x|x|x|x|x|x|x|x|x|y|y|x|x|x|x|x|x|x|x|x|x|x|x|x||xx||xx||xx||xx|x|y|x|x|x|xxx|x|||xxxxx|xx||||xx||||xx||x|x|x|x|x|x||yx||xx||xx|xx|x|||y||x||yx||xx|xxx|xx||||xx||||xx||x|x|x|x|x|x|x|x|x|x|xx||||xxxxx|x|x||xxxyxxyx|x|||xxx|x|||xxxxyxxyx|x|x|x||||xxx||xx||xxxyxxyx|x|||xxx|x|||xxx|||xxx|||xxx|||xxx|||xxx|x|xxyxxyx|||xxx|||xxxyyxxyxyyxxyx|||xxx|||xxx|||xxx|||xxxyyxxyxyyxxyx||xx||xx|x|x|x|x|x|x|x|x|x|||xyx|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x||xx||xx||xx||xx|x|x|x|x|x|xxx|x|||xxxxyxxyx|||xxx|||xxx|x|x|x|x|x|x||xy||xx||xx|xyxyx||xx|x||xy||xx|xxyxxyx|||xxx|||xxx|x|x|x|x|x|x|x|x|x|x|xy||||trrrr|q|q||||rwwrww|||||tww|t||||||rwwrww|u|||||||||||||qw||||rwwrww|||||tww|t|||tww|||tww|||||||||tww|||tww|t|trwwrww|||tww|||twwvvvrwwvvvrww||||||||||||||||||||||||vvvrwwvvvrww||||||tw|q|q|q|q|x|x|x|x|x|||qww|q|q|q|q|q|q|q|q|w|w|w|w|w|q|q|q|q|q|q|q|q|q|q|q|q|q|q|q|q||tw||tw||tw||tw|t|u|t|t|t||rr|t||||||rwwrww|||tww|||tww|q|q|q|q|q|q||tt||||||tw|twwww||xw|q||qw||tw|trwwrww|||tww|||tww|q|q|q|q|q|q|q|q|q|q|rv||||uuuuu|u|u||||uuuuuu|||||uuu|u||||||uuuuuu|u|||||||||||||uu||||uuuuuu|||||uuu|u|||uuu|||uuu|||||||||uuu|||uuu|u|uuuuuuu|||uuu|||uuuuuuuuuuuuuuu||||||||||||||||||||||||uuuuuuuuuuuu||||||uu|u|u|u|u|u|u|u|u|u|||uuu|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u||uu||uu||uu||uu|u|u|u|u|u||uu|u||||||uuuuuu|||uuu|||uuu|u|u|u|u|u|u||uu||||||uu|uuuuu||uu|u||uu||uu|uuuuuuu|||uuu|||uuu|u|u|u|u|u|u|u|u|u|u|uu||||x||||||||||xx|||||||x|||||||||||xxx|||||||||x|x||||xxx||||||xx|||||||x|||||||||||||||||||||||xxx||||||||||||||||||||||||||||||||||yyy|||yyy||||||xxx|||xxx|||xxx|||xxxyyy|||yyy|||||xx|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||y|y|y|||||||||||||||||||||||||||||x|||||||xxx||||||||||||||||||||||||||||||||||||xx|||||||||||||||||||||||||||||||||||||||||||||y|y|y|y|y|y|y|y|y|||yy||||knnnn|l|l||rrnrtnrt|r|||krt|k|||rrrnrtnrt|g|r|r||||rrr||mr||rrnrtnrt|r|||krt|k|||krt|||krt|||rrr|||krt|||krt|k|knrtnrt|||krt|||krtrrtnrtrrtnrt|||rrr|||rrr|||rrr|||rrrrrtnrtrrtnrt||rr||kr|l|l|l|l|m|m|m|m|m|||lmm|l|l|l|l|l|l|l|l|m|m|m|m|m|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l||mr||mr||mr||mr|m|m|n|n|g|rnn|k|||rrrnrtnrt|||krt|||krt|l|l|l|l|l|l||eo||rr||mr|lrtrt||tt|m||lm||kr|gnrtnrt|||krt|||krt|l|l|l|l|l|l|l|l|l|l|ir||||||||||w|w||ss|tt|tu|s||||tt|||||sss|tt|tu|||s|s||||sss|||p||ss|tt|tu|s||||tt||||||tt||||tt|||sss||||tt||||tt|||||tt|tu||||tt||||ttttt|ttttu|tu|||sss|||sss|||sss|||sssttt|ttttu|tu||ss|||t|w|w|w|w|w|w|w|w|w|||www|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|||||||||||||||||||||||||||s|||||||sss|tt|tu||||tt||||tt|w|w|w|w|w|w||||||ss||||||tttu||tt||||ww|||||||tt|tu||||tt||||tt|w|w|w|w|w|w|w|w|w|w||s|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
\ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.prx b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.prx Binary files differdeleted file mode 100644 index 601fb22d7..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.prx +++ /dev/null diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.tii b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.tii Binary files differdeleted file mode 100644 index 52941c7db..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.tii +++ /dev/null diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.tis b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.tis Binary files differdeleted file mode 100644 index d018fa672..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.tis +++ /dev/null diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fdt b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fdt Binary files differnew file mode 100644 index 000000000..9ab6d4d90 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fdt diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fdx b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fdx Binary files differnew file mode 100644 index 000000000..a26fbfa6b --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fdx diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fnm b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fnm Binary files differnew file mode 100644 index 000000000..b9f92430c --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fnm diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.nvd b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.nvd Binary files differnew file mode 100644 index 000000000..d832c2f6f --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.nvd diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.nvm b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.nvm Binary files differnew file mode 100644 index 000000000..a27cff81a --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.nvm diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.si b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.si Binary files differnew file mode 100644 index 000000000..2539c768d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.si diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.doc b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.doc Binary files differnew file mode 100644 index 000000000..0a2394bd2 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.doc diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.pos b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.pos Binary files differnew file mode 100644 index 000000000..4d9bbaad5 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.pos diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.tim b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.tim Binary files differnew file mode 100644 index 000000000..ac8475263 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.tim diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.tip b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.tip Binary files differnew file mode 100644 index 000000000..d94d9c92b --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.tip diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments.gen b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments.gen Binary files differindex e76c9033a..077a451a0 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments.gen +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments.gen diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments_8 b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments_8 Binary files differdeleted file mode 100644 index 8d4ef95e8..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments_8 +++ /dev/null diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments_9 b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments_9 Binary files differnew file mode 100644 index 000000000..a01b84fd7 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments_9 diff --git a/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java index a1a27dcb9..d293d5247 100644 --- a/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java +++ b/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java @@ -73,4 +73,10 @@ public class MockRepositorySessionFactory } }; } + + @Override + public void close() + { + // no op + } } diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml index fe40f6284..3e85ac5a5 100644 --- a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml +++ b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml @@ -58,6 +58,7 @@ <dependency> <groupId>org.apache.maven.indexer</groupId> <artifactId>indexer-core</artifactId> + <classifier>shaded-lucene</classifier> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> 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 deleted file mode 100644 index 448851ee7..000000000 --- a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.apache.archiva.common.plexusbridge; - -/* - * 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. - */ - -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; - -/** - * @author Olivier Lamy - * @since 1.4-M1 - */ -@Service( "mavenIndexerUtils" ) -public class MavenIndexerUtils -{ - - private Logger log = LoggerFactory.getLogger( getClass() ); - - private List<? extends IndexCreator> allIndexCreators; - - @Inject - public MavenIndexerUtils( PlexusSisuBridge plexusSisuBridge ) - throws PlexusSisuBridgeException - { - 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" ); - } - - log.debug( "allIndexCreators {}", allIndexCreators ); - } - - public List<? extends IndexCreator> getAllIndexCreators() - { - return allIndexCreators; - } - - public void setAllIndexCreators( List<IndexCreator> allIndexCreators ) - { - this.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..9c12ec813 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 @@ -21,12 +21,43 @@ <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"/> + <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 diff --git a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml index 5fa20f65d..42226575f 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml @@ -37,6 +37,10 @@ <artifactId>archiva-repository-admin-api</artifactId> </dependency> <dependency> + <groupId>org.apache.maven.archetype</groupId> + <artifactId>archetype-common</artifactId> + </dependency> + <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-provider-api</artifactId> </dependency> diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml index 217a33d3b..7374f3685 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml @@ -22,9 +22,9 @@ 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/> diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml index c19b3e867..7afd4a422 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml @@ -20,11 +20,8 @@ <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"/> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java index 08226d2e8..4d0a9a810 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java @@ -120,7 +120,7 @@ public abstract class AbstractProxyTestCase protected ManagedRepositoryAdmin managedRepositoryAdmin; @Inject - protected PlexusSisuBridge plexusSisuBridge; + protected NexusIndexer nexusIndexer; @Before public void setUp() @@ -198,7 +198,6 @@ public abstract class AbstractProxyTestCase protected void removeMavenIndexes() throws Exception { - NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() ) { diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml index a57c21fb2..b7e8ad21a 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml @@ -44,6 +44,7 @@ <dependency> <groupId>org.apache.maven.indexer</groupId> <artifactId>indexer-core</artifactId> + <classifier>shaded-lucene</classifier> <exclusions> <exclusion> <groupId>org.codehaus.plexus</groupId> @@ -73,6 +74,14 @@ <groupId>com.google.code.atinject</groupId> <artifactId>atinject</artifactId> </exclusion> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-queryparser</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-analyzers-common</artifactId> + </exclusion> </exclusions> </dependency> </dependencies> diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml index 46e9ccfdb..724d838f8 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml @@ -38,6 +38,19 @@ <artifactId>archiva-security-common</artifactId> </dependency> <dependency> + <groupId>org.apache.maven.indexer</groupId> + <artifactId>indexer-core</artifactId> + <classifier>shaded-lucene</classifier> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + <dependency> + <groupId>org.apache.maven.archetype</groupId> + <artifactId>archetype-common</artifactId> + </dependency> + <dependency> <groupId>org.apache.archiva</groupId> <artifactId>archiva-scheduler-repository-api</artifactId> </dependency> @@ -113,7 +126,6 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> - <version>${spring.version}</version> <exclusions> <exclusion> <groupId>commons-logging</groupId> @@ -124,7 +136,6 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> - <version>${spring.version}</version> <exclusions> <exclusion> <groupId>commons-logging</groupId> diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java index 7975d1f46..dea091287 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java @@ -23,9 +23,6 @@ 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.admin.repository.AbstractRepositoryAdmin; -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.configuration.Configuration; import org.apache.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.archiva.configuration.ProxyConnectorConfiguration; @@ -49,6 +46,7 @@ import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexCreator; import org.apache.maven.index.context.IndexingContext; import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException; +import org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -96,12 +94,6 @@ public class DefaultManagedRepositoryAdmin private RepositoryStatisticsManager repositoryStatisticsManager; @Inject - private PlexusSisuBridge plexusSisuBridge; - - @Inject - private MavenIndexerUtils mavenIndexerUtils; - - @Inject protected RoleManager roleManager; @Inject @@ -109,23 +101,16 @@ public class DefaultManagedRepositoryAdmin private Cache<String, Collection<String>> namespacesCache; // fields - List<? extends IndexCreator> indexCreators; + @Inject + private List<? extends IndexCreator> indexCreators; - NexusIndexer indexer; + @Inject + private NexusIndexer indexer; @PostConstruct public void initialize() throws RepositoryAdminException, RoleManagerException { - try - { - indexCreators = mavenIndexerUtils.getAllIndexCreators(); - indexer = plexusSisuBridge.lookup( NexusIndexer.class ); - } - catch ( PlexusSisuBridgeException e ) - { - throw new RepositoryAdminException( e.getMessage(), e ); - } // initialize index context on start and check roles here for ( ManagedRepository managedRepository : getManagedRepositories() ) { @@ -367,20 +352,14 @@ public class DefaultManagedRepositoryAdmin 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 ); @@ -660,24 +639,33 @@ public class DefaultManagedRepositoryAdmin if ( context == null ) { - context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory, - indexDirectory, - repositoryDirectory.toURI().toURL().toExternalForm(), - indexDirectory.toURI().toURL().toString(), indexCreators ); + try + { + context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory, + indexDirectory, + repositoryDirectory.toURI().toURL().toExternalForm(), + indexDirectory.toURI().toURL().toString(), indexCreators ); - context.setSearchable( repository.isScanned() ); + context.setSearchable( repository.isScanned() ); + } + catch ( IndexFormatTooOldException e ) + { + // existing index with an old lucene format so we need to delete it!!! + // delete it first then recreate it. + log.warn( "the index of repository {} is too old we have to delete and recreate it", // + repository.getId() ); + FileUtils.deleteDirectory( indexDirectory ); + context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory, + indexDirectory, + repositoryDirectory.toURI().toURL().toExternalForm(), + indexDirectory.toURI().toURL().toString(), indexCreators ); + + context.setSearchable( repository.isScanned() ); + } } return context; } - catch ( MalformedURLException e ) - { - throw new RepositoryAdminException( e.getMessage(), e ); - } - catch ( IOException e ) - { - throw new RepositoryAdminException( e.getMessage(), e ); - } - catch ( UnsupportedExistingLuceneIndexException e ) + catch ( IOException| UnsupportedExistingLuceneIndexException e ) { throw new RepositoryAdminException( e.getMessage(), e ); } @@ -824,26 +812,6 @@ public class DefaultManagedRepositoryAdmin this.repositoryTaskScheduler = repositoryTaskScheduler; } - public PlexusSisuBridge getPlexusSisuBridge() - { - return plexusSisuBridge; - } - - public void setPlexusSisuBridge( PlexusSisuBridge plexusSisuBridge ) - { - this.plexusSisuBridge = plexusSisuBridge; - } - - public MavenIndexerUtils getMavenIndexerUtils() - { - return mavenIndexerUtils; - } - - public void setMavenIndexerUtils( MavenIndexerUtils mavenIndexerUtils ) - { - this.mavenIndexerUtils = mavenIndexerUtils; - } - public NexusIndexer getIndexer() { return indexer; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java index 8f390530b..01f733767 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java @@ -23,19 +23,19 @@ import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.RemoteRepository; import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin; import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; -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.common.utils.FileUtil; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.ProxyConnectorConfiguration; import org.apache.archiva.configuration.RemoteRepositoryConfiguration; import org.apache.archiva.configuration.RepositoryCheckPath; import org.apache.archiva.metadata.model.facets.AuditEvent; +import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexCreator; import org.apache.maven.index.context.IndexingContext; import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException; +import org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; @@ -60,29 +60,15 @@ public class DefaultRemoteRepositoryAdmin { @Inject - private PlexusSisuBridge plexusSisuBridge; - - @Inject - private MavenIndexerUtils mavenIndexerUtils; - - // fields private List<? extends IndexCreator> indexCreators; + @Inject private NexusIndexer indexer; @PostConstruct private void initialize() throws RepositoryAdminException { - try - { - indexCreators = mavenIndexerUtils.getAllIndexCreators(); - indexer = plexusSisuBridge.lookup( NexusIndexer.class ); - } - catch ( PlexusSisuBridgeException e ) - { - throw new RepositoryAdminException( e.getMessage(), e ); - } for ( RemoteRepository remoteRepository : getRemoteRepositories() ) { createIndexContext( remoteRepository ); @@ -321,19 +307,28 @@ public class DefaultRemoteRepositoryAdmin { indexDirectory.mkdirs(); } - return indexer.addIndexingContext( contextKey, remoteRepository.getId(), repoDir, indexDirectory, - remoteRepository.getUrl(), calculateIndexRemoteUrl( remoteRepository ), - mavenIndexerUtils.getAllIndexCreators() ); - } - catch ( MalformedURLException e ) - { - throw new RepositoryAdminException( e.getMessage(), e ); - } - catch ( IOException e ) - { - throw new RepositoryAdminException( e.getMessage(), e ); + + try + { + + return indexer.addIndexingContext( contextKey, remoteRepository.getId(), repoDir, indexDirectory, + remoteRepository.getUrl(), calculateIndexRemoteUrl( remoteRepository ), + indexCreators ); + } + catch ( IndexFormatTooOldException e ) + { + // existing index with an old lucene format so we need to delete it!!! + // delete it first then recreate it. + log.warn( "the index of repository {} is too old we have to delete and recreate it", // + remoteRepository.getId() ); + FileUtils.deleteDirectory( indexDirectory ); + return indexer.addIndexingContext( contextKey, remoteRepository.getId(), repoDir, indexDirectory, + remoteRepository.getUrl(), calculateIndexRemoteUrl( remoteRepository ), + indexCreators ); + + } } - catch ( UnsupportedExistingLuceneIndexException e ) + catch ( IOException | UnsupportedExistingLuceneIndexException e ) { throw new RepositoryAdminException( e.getMessage(), e ); } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml index aa4743ccc..15d377058 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml @@ -22,14 +22,13 @@ 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"/> diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml index 2901cbb46..84adf6d01 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml @@ -20,11 +20,14 @@ --> <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/> |