diff options
author | Martin Stockhammer <martin.stockhammer@ars.de> | 2017-11-11 00:07:56 +0100 |
---|---|---|
committer | Martin Stockhammer <martin.stockhammer@ars.de> | 2017-11-11 00:07:56 +0100 |
commit | c6e4e563d6698aa7cb5772878bc0fe22066b7884 (patch) | |
tree | f51d17add16cc3d220d6752c41921bde83e4526b /archiva-modules/archiva-base/archiva-maven2-indexer | |
parent | 8f520999ff9b42396a013bb42bc450945ddc4b5d (diff) | |
download | archiva-c6e4e563d6698aa7cb5772878bc0fe22066b7884.tar.gz archiva-c6e4e563d6698aa7cb5772878bc0fe22066b7884.zip |
Implementation of new archivaindexer
Not finished yet, but uses the maven index service via spring dependency injection
Moving some maven specific classes to subpackages
Diffstat (limited to 'archiva-modules/archiva-base/archiva-maven2-indexer')
12 files changed, 395 insertions, 28 deletions
diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/pom.xml b/archiva-modules/archiva-base/archiva-maven2-indexer/pom.xml index f0a90a5d1..bc141b654 100644 --- a/archiva-modules/archiva-base/archiva-maven2-indexer/pom.xml +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/pom.xml @@ -124,11 +124,6 @@ </dependency> <dependency> <groupId>org.apache.archiva</groupId> - <artifactId>archiva-configuration</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.archiva</groupId> <artifactId>archiva-repository-admin-default</artifactId> <scope>test</scope> </dependency> @@ -183,7 +178,35 @@ <artifactId>hsqldb</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-configuration</artifactId> + </dependency> + <dependency> + <groupId>org.apache.maven.indexer</groupId> + <artifactId>indexer-core</artifactId> + <classifier>shaded-lucene</classifier> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-core</artifactId> + <exclusions> + <exclusion> + <groupId>org.sonatype.sisu</groupId> + <artifactId>sisu-guava</artifactId> + </exclusion> + <exclusion> + <groupId>org.sonatype.sisu</groupId> + <artifactId>sisu-inject</artifactId> + </exclusion> + <exclusion> + <groupId>org.sonatype.sisu</groupId> + <artifactId>sisu-guice</artifactId> + </exclusion> + </exclusions> + </dependency> </dependencies> + <build> <pluginManagement> <plugins> diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/DefaultIndexUpdateSideEffect.java b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/DefaultIndexUpdateSideEffect.java new file mode 100644 index 000000000..cb66cbb53 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/DefaultIndexUpdateSideEffect.java @@ -0,0 +1,47 @@ +package org.apache.archiva.indexer.maven; + +/* + * 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.IndexingContext; +import org.apache.maven.index.updater.IndexUpdateSideEffect; +import org.apache.maven.index_shaded.lucene.store.Directory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +/** + * Not doing much but required at least one implementation + * + * @since 3.0.0 + */ +@Service("archivaIndexUpdater") +public class DefaultIndexUpdateSideEffect + implements IndexUpdateSideEffect +{ + private static final Logger LOGGER = LoggerFactory.getLogger( DefaultIndexUpdateSideEffect.class ); + + @Override + public void updateIndex( Directory directory, IndexingContext indexingContext, boolean b ) + { + LOGGER.info( "updating index: {} with directory: {}", // + indexingContext.getId(), // + directory.toString() ); + } +} diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexContext.java b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexContext.java new file mode 100644 index 000000000..30cc72795 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexContext.java @@ -0,0 +1,122 @@ +package org.apache.archiva.indexer.maven; + +/* + * 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.archiva.indexer.ArchivaIndexingContext; +import org.apache.archiva.repository.Repository; +import org.apache.maven.index.context.IndexingContext; + +import java.io.IOException; +import java.net.URI; +import java.nio.file.Files; +import java.sql.Date; +import java.time.ZonedDateTime; +import java.util.Set; + +/** + * Maven implementation of index context + */ +public class MavenIndexContext implements ArchivaIndexingContext { + + private IndexingContext delegate; + private Repository repository; + + MavenIndexContext(Repository repository, IndexingContext delegate) { + this.delegate = delegate; + this.repository = repository; + + } + + @Override + public String getId() { + return delegate.getId(); + } + + @Override + public Repository getRepository() { + return repository; + } + + @Override + public URI getPath() { + return delegate.getIndexDirectoryFile().toURI(); + } + + @Override + public boolean isEmpty() throws IOException { + return Files.list(delegate.getIndexDirectoryFile().toPath()).count()==0; + } + + @Override + public void commit() throws IOException { + delegate.commit(); + } + + @Override + public void rollback() throws IOException { + delegate.rollback(); + } + + @Override + public void optimize() throws IOException { + delegate.optimize(); + } + + @Override + public void close(boolean deleteFiles) throws IOException { + delegate.close(deleteFiles); + } + + @Override + public void purge() throws IOException { + delegate.purge(); + } + + @Override + public boolean supports(Class<?> clazz) { + return IndexingContext.class.equals(clazz); + } + + @Override + public <T> T getBaseContext(Class<T> clazz) throws UnsupportedOperationException { + if (IndexingContext.class.equals(clazz)) { + return (T) delegate; + } else { + throw new UnsupportedOperationException("The class "+clazz+" is not supported by the maven indexer"); + } + } + + @Override + public Set<String> getGroups() throws IOException { + return delegate.getAllGroups(); + } + + @Override + public void updateTimestamp(boolean save) throws IOException { + delegate.updateTimestamp(save); + } + + @Override + public void updateTimestamp(boolean save, ZonedDateTime time) throws IOException { + delegate.updateTimestamp(save, Date.from(time.toInstant())); + } + + +} diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java new file mode 100644 index 000000000..12d858648 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java @@ -0,0 +1,171 @@ +package org.apache.archiva.indexer.maven; + +/* + * 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.archiva.common.utils.PathUtil; +import org.apache.archiva.configuration.ArchivaConfiguration; +import org.apache.archiva.indexer.ArchivaIndexManager; +import org.apache.archiva.indexer.ArchivaIndexingContext; +import org.apache.archiva.model.ArtifactReference; +import org.apache.archiva.repository.ManagedRepository; +import org.apache.archiva.repository.RemoteRepository; +import org.apache.archiva.repository.Repository; +import org.apache.archiva.repository.RepositoryType; +import org.apache.archiva.repository.features.RemoteIndexFeature; +import org.apache.maven.index.Indexer; +import org.apache.maven.index.context.IndexCreator; +import org.apache.maven.index.context.IndexingContext; +import org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.inject.Inject; +import java.io.IOException; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; + +/** + * Maven implementation of index manager + */ +@Service("archivaIndexManager#maven") +public class MavenIndexManager implements ArchivaIndexManager { + + private static final Logger log = LoggerFactory.getLogger(MavenIndexManager.class); + + @Inject + private Indexer indexer; + + @Inject + private List<? extends IndexCreator> indexCreators; + + @Inject + private ArchivaConfiguration archivaConfiguration; + + @Override + public void pack(ArchivaIndexingContext context) { + + } + + @Override + public void scan(ArchivaIndexingContext context, boolean update) { + + } + + @Override + public void update(ArchivaIndexingContext context, URI remoteUpdateUri, boolean fullUpdate) { + + } + + @Override + public void addArtifactToIndex(ArchivaIndexingContext context, ArtifactReference artifactReference) { + + } + + @Override + public void removeArtifactFromIndex(ArchivaIndexingContext context, ArtifactReference artifactReference) { + + } + + @Override + public boolean supportsRepository(RepositoryType type) { + return false; + } + + @Override + public ArchivaIndexingContext createContext(Repository remoteRepository) throws IOException { + IndexingContext mvnCtx = null; + if (remoteRepository instanceof RemoteRepository) { + mvnCtx = createRemoteContext((RemoteRepository) remoteRepository); + } else if (remoteRepository instanceof ManagedRepository) { + // TODO: Implement managed repository index creation + mvnCtx = null; + } + MavenIndexContext context = new MavenIndexContext(remoteRepository, mvnCtx); + return null; + } + + private IndexingContext createRemoteContext(RemoteRepository remoteRepository) throws IOException { + Path appServerBase = archivaConfiguration.getAppServerBaseDir(); + + String contextKey = "remote-" + remoteRepository.getId(); + + // create remote repository path + Path repoDir = appServerBase.resolve( "data").resolve( "remotes" ).resolve( remoteRepository.getId() ); + if ( !Files.exists(repoDir) ) + { + Files.createDirectories(repoDir); + } + + Path indexDirectory = null; + + // is there configured indexDirectory ? + if (remoteRepository.supportsFeature(RemoteIndexFeature.class)) { + RemoteIndexFeature rif = remoteRepository.getFeature(RemoteIndexFeature.class).get(); + indexDirectory = PathUtil.getPathFromUri(rif.getIndexUri()); + if (!indexDirectory.isAbsolute()) { + indexDirectory = repoDir.resolve(indexDirectory); + } + + // if not configured use a default value + if (indexDirectory == null) { + indexDirectory = repoDir.resolve(".index"); + } + if (!Files.exists(indexDirectory)) { + Files.createDirectories(indexDirectory); + } + + try { + + return indexer.createIndexingContext(contextKey, remoteRepository.getId(), repoDir.toFile(), indexDirectory.toFile(), + remoteRepository.getLocation() == null ? null : remoteRepository.getLocation().toString(), + calculateIndexRemoteUrl(remoteRepository.getLocation(), rif), + true, false, + 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()); + org.apache.archiva.common.utils.FileUtils.deleteDirectory(indexDirectory); + return indexer.createIndexingContext(contextKey, remoteRepository.getId(), repoDir.toFile(), indexDirectory.toFile(), + remoteRepository.getLocation() == null ? null : remoteRepository.getLocation().toString(), + calculateIndexRemoteUrl(remoteRepository.getLocation(), rif), + true, false, + indexCreators); + + } + } else { + throw new IOException("No remote index defined"); + } + } + + private String calculateIndexRemoteUrl(URI baseUri, RemoteIndexFeature rif) { + if (rif.getIndexUri()==null) { + return baseUri.resolve(".index").toString(); + } else { + return baseUri.resolve(rif.getIndexUri()).toString(); + } + } + + +} diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/merger/DefaultIndexMerger.java index b4daa8bd8..0e0cd9059 100644 --- a/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/merger/DefaultIndexMerger.java @@ -1,4 +1,4 @@ -package org.apache.archiva.indexer.merger; +package org.apache.archiva.indexer.maven.merger; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -19,6 +19,10 @@ package org.apache.archiva.indexer.merger; */ import org.apache.archiva.common.utils.FileUtils; +import org.apache.archiva.indexer.merger.IndexMerger; +import org.apache.archiva.indexer.merger.IndexMergerException; +import org.apache.archiva.indexer.merger.IndexMergerRequest; +import org.apache.archiva.indexer.merger.TemporaryGroupIndex; import org.apache.commons.lang.time.StopWatch; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexCreator; diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearch.java index b6f49840e..590cdd244 100644 --- a/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearch.java @@ -1,4 +1,4 @@ -package org.apache.archiva.indexer.search; +package org.apache.archiva.indexer.maven.search; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -25,6 +25,7 @@ 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.PlexusSisuBridgeException; +import org.apache.archiva.indexer.search.*; import org.apache.archiva.indexer.util.SearchUtil; import org.apache.archiva.model.ArchivaArtifactModel; import org.apache.archiva.model.ArtifactReference; @@ -96,8 +97,8 @@ public class MavenRepositorySearch * @see RepositorySearch#search(String, List, String, SearchResultLimits, List) */ @Override - public SearchResults search( String principal, List<String> selectedRepos, String term, SearchResultLimits limits, - List<String> previousSearchTerms ) + public SearchResults search(String principal, List<String> selectedRepos, String term, SearchResultLimits limits, + List<String> previousSearchTerms ) throws RepositorySearchException { List<String> indexingContextIds = addIndexingContexts( selectedRepos ); diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/resources/META-INF/spring-context.xml index 8c0de11db..870a13b56 100644 --- a/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/resources/META-INF/spring-context.xml @@ -22,23 +22,15 @@ <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:task="http://www.springframework.org/schema/task" 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/task - http://www.springframework.org/schema/task/spring-task-3.0.xsd" + http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="false"> <context:annotation-config/> - <context:component-scan base-package="org.apache.archiva.indexer.search,org.apache.archiva.indexer.merger"/> + <context:component-scan base-package="org.apache.archiva.indexer.maven,org.apache.maven.index"/> - <bean id="logger" class="org.apache.archiva.common.utils.Slf4JPlexusLogger"> - <constructor-arg type="java.lang.Class"> - <value>org.apache.maven.index.DefaultNexusIndexer</value> - </constructor-arg> - </bean> <bean name="taskScheduler#mergeRemoteIndexes" class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler"> diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java b/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/maven/search/AbstractMavenRepositorySearch.java index ab85ec59b..07fcc09ba 100644 --- a/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/maven/search/AbstractMavenRepositorySearch.java @@ -1,4 +1,4 @@ -package org.apache.archiva.indexer.search; +package org.apache.archiva.indexer.maven.search; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -28,6 +28,9 @@ import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.ConfigurationListener; import org.apache.archiva.configuration.ManagedRepositoryConfiguration; +import org.apache.archiva.indexer.maven.search.MavenRepositorySearch; +import org.apache.archiva.indexer.search.SearchResultHit; +import org.apache.archiva.indexer.search.SearchResults; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.lang.SystemUtils; diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchOSGITest.java b/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchOSGITest.java index 69429303d..e99947fa8 100644 --- a/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchOSGITest.java +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchOSGITest.java @@ -1,4 +1,4 @@ -package org.apache.archiva.indexer.search; +package org.apache.archiva.indexer.maven.search; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -19,6 +19,9 @@ package org.apache.archiva.indexer.search; * under the License. */ +import org.apache.archiva.indexer.search.SearchFields; +import org.apache.archiva.indexer.search.SearchResultHit; +import org.apache.archiva.indexer.search.SearchResults; import org.easymock.EasyMock; import org.junit.Test; diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchPaginateTest.java b/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchPaginateTest.java index 802444a67..c8498b29a 100644 --- a/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchPaginateTest.java +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchPaginateTest.java @@ -1,4 +1,4 @@ -package org.apache.archiva.indexer.search; +package org.apache.archiva.indexer.maven.search; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -19,6 +19,10 @@ package org.apache.archiva.indexer.search; */ import junit.framework.TestCase; +import org.apache.archiva.indexer.maven.search.MavenRepositorySearch; +import org.apache.archiva.indexer.search.SearchResultHit; +import org.apache.archiva.indexer.search.SearchResultLimits; +import org.apache.archiva.indexer.search.SearchResults; import org.apache.archiva.indexer.util.SearchUtil; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java b/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchTest.java index 3c10633b0..1cc157482 100644 --- a/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/java/org/apache/archiva/indexer/maven/search/MavenRepositorySearchTest.java @@ -1,4 +1,4 @@ -package org.apache.archiva.indexer.search; +package org.apache.archiva.indexer.maven.search; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -19,20 +19,16 @@ package org.apache.archiva.indexer.search; * under the License. */ -import org.apache.archiva.configuration.ConfigurationEvent; -import org.apache.archiva.configuration.ConfigurationListener; +import org.apache.archiva.indexer.search.*; import org.apache.archiva.indexer.util.SearchUtil; -import org.apache.archiva.repository.RepositoryRegistry; 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.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; -import javax.inject.Inject; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/resources/spring-context.xml index e0bf5c41c..13ef95f3c 100644 --- a/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/src/test/resources/spring-context.xml @@ -28,6 +28,7 @@ default-lazy-init="false"> <context:annotation-config/> + <context:component-scan base-package="org.apache.archiva.indexer.maven" /> <bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler"> <property name="properties"> |