mirror of https://github.com/apache/archiva.git
Merge branch 'feature/jcr_oak'
This commit is contained in:
commit
7a2710ec0a
|
@ -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>
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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>
|
||||
|
@ -110,21 +131,6 @@
|
|||
<artifactId>metadata-store-jcr</artifactId>
|
||||
<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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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" );
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
||||
|
|
|
@ -48,14 +48,6 @@
|
|||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-queries</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
|
@ -82,9 +74,24 @@
|
|||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.indexer</groupId>
|
||||
<artifactId>indexer-reader</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.indexer</groupId>
|
||||
<artifactId>indexer-core</artifactId>
|
||||
<classifier>shaded-lucene</classifier>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<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>
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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() );
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,5 +0,0 @@
|
|||
༚
|
||||
䑅千剉偔佒ć䥄塉乆伐ŵā洐ũခ朁šā瘁ݧ牯異䥤<EFBFBD>
|
||||
慲瑩晡捴䥤ć癥牳楯渁Űāţ<EFBFBD>
|
||||
捬慳獮慭敳ē䉵湤汥ⵓ祭扯汩捎慭攁โ畮摬攭噥牳楯渁ๅ硰潲琭偡捫慧攁ๅ硰潲琭卥牶楣攁ୂ畮摬攭乡浥Ď䥭灯牴ⵐ慣歡来Ď剥煵楲攭䉵湤汥<EFBFBD>
|
||||
牯潴䝲潵灳Ď牯潴䝲潵灳䱩獴ဉ慬汇牯異猁ൡ汬䝲潵灳䱩獴<EFBFBD>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -73,4 +73,10 @@ public class MockRepositorySessionFactory
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
// no op
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -36,6 +36,10 @@
|
|||
<groupId>org.apache.archiva</groupId>
|
||||
<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>
|
||||
|
|
|
@ -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/>
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -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() )
|
||||
{
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -37,6 +37,19 @@
|
|||
<groupId>org.apache.archiva</groupId>
|
||||
<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>
|
||||
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
@ -95,12 +93,6 @@ public class DefaultManagedRepositoryAdmin
|
|||
@Inject
|
||||
private RepositoryStatisticsManager repositoryStatisticsManager;
|
||||
|
||||
@Inject
|
||||
private PlexusSisuBridge plexusSisuBridge;
|
||||
|
||||
@Inject
|
||||
private MavenIndexerUtils mavenIndexerUtils;
|
||||
|
||||
@Inject
|
||||
protected RoleManager roleManager;
|
||||
|
||||
|
@ -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;
|
||||
|
|
|
@ -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() );
|
||||
|
||||
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 ( 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 );
|
||||
}
|
||||
|
|
|
@ -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"/>
|
||||
|
||||
|
|
|
@ -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/>
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.maven.indexer</groupId>
|
||||
<artifactId>indexer-core</artifactId>
|
||||
<classifier>shaded-lucene</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
|
|
|
@ -23,13 +23,9 @@ package org.apache.archiva.scheduler.indexing;
|
|||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.beans.ManagedRepository;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
|
||||
import org.apache.archiva.redback.components.taskqueue.Task;
|
||||
import org.apache.archiva.redback.components.taskqueue.execution.TaskExecutionException;
|
||||
import org.apache.archiva.redback.components.taskqueue.execution.TaskExecutor;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.maven.index.ArtifactContext;
|
||||
import org.apache.maven.index.ArtifactContextProducer;
|
||||
import org.apache.maven.index.FlatSearchRequest;
|
||||
|
@ -40,11 +36,12 @@ import org.apache.maven.index.context.IndexingContext;
|
|||
import org.apache.maven.index.expr.SourcedSearchExpression;
|
||||
import org.apache.maven.index.packer.IndexPacker;
|
||||
import org.apache.maven.index.packer.IndexPackingRequest;
|
||||
import org.apache.maven.index_shaded.lucene.search.BooleanClause;
|
||||
import org.apache.maven.index_shaded.lucene.search.BooleanQuery;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -54,37 +51,24 @@ import java.io.IOException;
|
|||
* all performed by this executor. Add and update artifact in index tasks are added in the indexing task queue by the
|
||||
* NexusIndexerConsumer while remove artifact from index tasks are added by the LuceneCleanupRemoveIndexedConsumer.
|
||||
*/
|
||||
@Service ( "taskExecutor#indexing" )
|
||||
@Service( "taskExecutor#indexing" )
|
||||
public class ArchivaIndexingTaskExecutor
|
||||
implements TaskExecutor
|
||||
{
|
||||
private Logger log = LoggerFactory.getLogger( ArchivaIndexingTaskExecutor.class );
|
||||
|
||||
@Inject
|
||||
private IndexPacker indexPacker;
|
||||
|
||||
private ArtifactContextProducer artifactContextProducer;
|
||||
|
||||
@Inject
|
||||
private PlexusSisuBridge plexusSisuBridge;
|
||||
private ArtifactContextProducer artifactContextProducer;
|
||||
|
||||
@Inject
|
||||
private ManagedRepositoryAdmin managedRepositoryAdmin;
|
||||
|
||||
@Inject
|
||||
private NexusIndexer nexusIndexer;
|
||||
|
||||
@PostConstruct
|
||||
public void initialize()
|
||||
throws PlexusSisuBridgeException
|
||||
{
|
||||
log.info( "Initialized {}", this.getClass().getName() );
|
||||
|
||||
artifactContextProducer = plexusSisuBridge.lookup( ArtifactContextProducer.class );
|
||||
|
||||
indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" );
|
||||
|
||||
nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* depending on current {@link Task} you have.
|
||||
|
@ -128,9 +112,10 @@ public class ArchivaIndexingTaskExecutor
|
|||
{
|
||||
try
|
||||
{
|
||||
log.debug( "Creating indexing context on resource: {}", ( indexingTask.getResourceFile() == null
|
||||
? "none"
|
||||
: indexingTask.getResourceFile().getPath() ) );
|
||||
log.debug( "Creating indexing context on resource: {}", //
|
||||
( indexingTask.getResourceFile() == null
|
||||
? "none"
|
||||
: indexingTask.getResourceFile().getPath() ) );
|
||||
context = managedRepositoryAdmin.createIndexContext( repository );
|
||||
}
|
||||
catch ( RepositoryAdminException e )
|
||||
|
@ -162,9 +147,9 @@ public class ArchivaIndexingTaskExecutor
|
|||
// TODO make that configurable?
|
||||
if ( artifactFile.getPath().endsWith( ".pom" ) )
|
||||
{
|
||||
ac.getArtifactInfo().fextension = "pom";
|
||||
ac.getArtifactInfo().packaging = "pom";
|
||||
ac.getArtifactInfo().classifier = "pom";
|
||||
ac.getArtifactInfo().setFileExtension( "pom" );
|
||||
ac.getArtifactInfo().setPackaging( "pom" );
|
||||
ac.getArtifactInfo().setClassifier( "pom" );
|
||||
}
|
||||
if ( indexingTask.getAction().equals( ArtifactIndexingTask.Action.ADD ) )
|
||||
{
|
||||
|
@ -174,20 +159,20 @@ public class ArchivaIndexingTaskExecutor
|
|||
|
||||
BooleanQuery q = new BooleanQuery();
|
||||
q.add( nexusIndexer.constructQuery( MAVEN.GROUP_ID, new SourcedSearchExpression(
|
||||
ac.getArtifactInfo().groupId ) ), BooleanClause.Occur.MUST );
|
||||
ac.getArtifactInfo().getGroupId() ) ), BooleanClause.Occur.MUST );
|
||||
q.add( nexusIndexer.constructQuery( MAVEN.ARTIFACT_ID, new SourcedSearchExpression(
|
||||
ac.getArtifactInfo().artifactId ) ), BooleanClause.Occur.MUST );
|
||||
ac.getArtifactInfo().getArtifactId() ) ), BooleanClause.Occur.MUST );
|
||||
q.add( nexusIndexer.constructQuery( MAVEN.VERSION, new SourcedSearchExpression(
|
||||
ac.getArtifactInfo().version ) ), BooleanClause.Occur.MUST );
|
||||
if ( ac.getArtifactInfo().classifier != null )
|
||||
ac.getArtifactInfo().getVersion() ) ), BooleanClause.Occur.MUST );
|
||||
if ( ac.getArtifactInfo().getClassifier() != null )
|
||||
{
|
||||
q.add( nexusIndexer.constructQuery( MAVEN.CLASSIFIER, new SourcedSearchExpression(
|
||||
ac.getArtifactInfo().classifier ) ), BooleanClause.Occur.MUST );
|
||||
ac.getArtifactInfo().getClassifier() ) ), BooleanClause.Occur.MUST );
|
||||
}
|
||||
if ( ac.getArtifactInfo().packaging != null )
|
||||
if ( ac.getArtifactInfo().getPackaging() != null )
|
||||
{
|
||||
q.add( nexusIndexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression(
|
||||
ac.getArtifactInfo().packaging ) ), BooleanClause.Occur.MUST );
|
||||
ac.getArtifactInfo().getPackaging() ) ), BooleanClause.Occur.MUST );
|
||||
}
|
||||
FlatSearchRequest flatSearchRequest = new FlatSearchRequest( q, context );
|
||||
FlatSearchResponse flatSearchResponse = nexusIndexer.searchFlat( flatSearchRequest );
|
||||
|
@ -248,7 +233,11 @@ public class ArchivaIndexingTaskExecutor
|
|||
if ( !repository.isSkipPackedIndexCreation() )
|
||||
{
|
||||
|
||||
IndexPackingRequest request = new IndexPackingRequest( context, context.getIndexDirectoryFile() );
|
||||
IndexPackingRequest request = new IndexPackingRequest( context, //
|
||||
context.acquireIndexSearcher().getIndexReader(),
|
||||
//
|
||||
context.getIndexDirectoryFile() );
|
||||
|
||||
indexPacker.packIndex( request );
|
||||
context.updateTimestamp( true );
|
||||
|
||||
|
@ -272,13 +261,4 @@ public class ArchivaIndexingTaskExecutor
|
|||
this.indexPacker = indexPacker;
|
||||
}
|
||||
|
||||
public PlexusSisuBridge getPlexusSisuBridge()
|
||||
{
|
||||
return plexusSisuBridge;
|
||||
}
|
||||
|
||||
public void setPlexusSisuBridge( PlexusSisuBridge plexusSisuBridge )
|
||||
{
|
||||
this.plexusSisuBridge = plexusSisuBridge;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ package org.apache.archiva.scheduler.indexing;
|
|||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.beans.ManagedRepository;
|
||||
import org.apache.maven.index.context.IndexingContext;
|
||||
import org.apache.archiva.redback.components.taskqueue.Task;
|
||||
import org.apache.maven.index.context.IndexingContext;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
@ -79,8 +79,14 @@ public class ArtifactIndexingTask
|
|||
}
|
||||
|
||||
public void setExecuteOnEntireRepo( boolean executeOnEntireRepo )
|
||||
{
|
||||
this.executeOnEntireRepo( executeOnEntireRepo );
|
||||
}
|
||||
|
||||
public ArtifactIndexingTask executeOnEntireRepo( boolean executeOnEntireRepo )
|
||||
{
|
||||
this.executeOnEntireRepo = executeOnEntireRepo;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,8 +25,6 @@ import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
|
|||
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
|
||||
import org.apache.archiva.common.ArchivaException;
|
||||
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.ConfigurationEvent;
|
||||
|
@ -57,7 +55,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||
* @author Olivier Lamy
|
||||
* @since 1.4-M1
|
||||
*/
|
||||
@Service ("downloadRemoteIndexScheduler#default")
|
||||
@Service( "downloadRemoteIndexScheduler#default" )
|
||||
public class DefaultDownloadRemoteIndexScheduler
|
||||
implements ConfigurationListener, DownloadRemoteIndexScheduler
|
||||
{
|
||||
|
@ -65,7 +63,7 @@ public class DefaultDownloadRemoteIndexScheduler
|
|||
private Logger log = LoggerFactory.getLogger( getClass() );
|
||||
|
||||
@Inject
|
||||
@Named (value = "taskScheduler#indexDownloadRemote")
|
||||
@Named( value = "taskScheduler#indexDownloadRemote" )
|
||||
private TaskScheduler taskScheduler;
|
||||
|
||||
@Inject
|
||||
|
@ -84,15 +82,12 @@ public class DefaultDownloadRemoteIndexScheduler
|
|||
private NetworkProxyAdmin networkProxyAdmin;
|
||||
|
||||
@Inject
|
||||
private PlexusSisuBridge plexusSisuBridge;
|
||||
|
||||
@Inject
|
||||
private MavenIndexerUtils mavenIndexerUtils;
|
||||
|
||||
private NexusIndexer nexusIndexer;
|
||||
|
||||
@Inject
|
||||
private IndexUpdater indexUpdater;
|
||||
|
||||
@Inject
|
||||
private IndexPacker indexPacker;
|
||||
|
||||
// store ids about currently running remote download : updated in DownloadRemoteIndexTask
|
||||
|
@ -106,12 +101,6 @@ public class DefaultDownloadRemoteIndexScheduler
|
|||
archivaConfiguration.addListener( this );
|
||||
// TODO add indexContexts even if null
|
||||
|
||||
nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
|
||||
|
||||
indexUpdater = plexusSisuBridge.lookup( IndexUpdater.class );
|
||||
|
||||
this.indexPacker = plexusSisuBridge.lookup( IndexPacker.class );
|
||||
|
||||
for ( RemoteRepository remoteRepository : remoteRepositoryAdmin.getRemoteRepositories() )
|
||||
{
|
||||
String contextKey = "remote-" + remoteRepository.getId();
|
||||
|
@ -180,11 +169,14 @@ public class DefaultDownloadRemoteIndexScheduler
|
|||
}
|
||||
}
|
||||
|
||||
DownloadRemoteIndexTaskRequest downloadRemoteIndexTaskRequest =
|
||||
new DownloadRemoteIndexTaskRequest().setRemoteRepository( remoteRepository ).setNetworkProxy(
|
||||
networkProxy ).setFullDownload( fullDownload ).setWagonFactory(
|
||||
wagonFactory ).setRemoteRepositoryAdmin( remoteRepositoryAdmin ).setIndexUpdater(
|
||||
indexUpdater ).setIndexPacker( this.indexPacker );
|
||||
DownloadRemoteIndexTaskRequest downloadRemoteIndexTaskRequest = new DownloadRemoteIndexTaskRequest() //
|
||||
.setRemoteRepository( remoteRepository ) //
|
||||
.setNetworkProxy( networkProxy ) //
|
||||
.setFullDownload( fullDownload ) //
|
||||
.setWagonFactory( wagonFactory ) //
|
||||
.setRemoteRepositoryAdmin( remoteRepositoryAdmin ) //
|
||||
.setIndexUpdater( indexUpdater ) //
|
||||
.setIndexPacker( this.indexPacker );
|
||||
|
||||
if ( now )
|
||||
{
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package org.apache.archiva.scheduler.indexing;
|
||||
|
||||
/*
|
||||
* 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_shaded.lucene.store.Directory;
|
||||
import org.apache.maven.index.updater.IndexUpdateSideEffect;
|
||||
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
|
||||
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() );
|
||||
}
|
||||
}
|
|
@ -196,32 +196,7 @@ public class DownloadRemoteIndexTask
|
|||
indexingContext.updateTimestamp( true );
|
||||
|
||||
}
|
||||
catch ( MalformedURLException e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
}
|
||||
catch ( WagonFactoryException e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
}
|
||||
catch ( ConnectionException e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
}
|
||||
catch ( AuthenticationException e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
}
|
||||
catch ( RepositoryAdminException e )
|
||||
catch ( Exception e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
|
|
|
@ -22,21 +22,24 @@ package org.apache.archiva.scheduler.indexing;
|
|||
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.test.utils.ArchivaSpringJUnit4ClassRunner;
|
||||
import org.apache.lucene.search.BooleanClause.Occur;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.IndexSearcher;
|
||||
import org.apache.lucene.search.TopDocs;
|
||||
import org.apache.maven.index.ArtifactInfo;
|
||||
import org.apache.maven.index.FlatSearchRequest;
|
||||
import org.apache.maven.index.FlatSearchResponse;
|
||||
import org.apache.maven.index.MAVEN;
|
||||
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.expr.SourcedSearchExpression;
|
||||
import org.apache.maven.index.expr.StringSearchExpression;
|
||||
import org.apache.maven.index_shaded.lucene.search.BooleanClause;
|
||||
import org.apache.maven.index_shaded.lucene.search.BooleanQuery;
|
||||
import org.apache.maven.index_shaded.lucene.search.IndexSearcher;
|
||||
import org.apache.maven.index_shaded.lucene.search.TopDocs;
|
||||
import org.apache.maven.index.updater.DefaultIndexUpdater;
|
||||
import org.apache.maven.index.updater.IndexUpdateRequest;
|
||||
import org.apache.maven.index.updater.IndexUpdater;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
@ -44,18 +47,10 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
/**
|
||||
* ArchivaIndexingTaskExecutorTest
|
||||
|
@ -70,17 +65,18 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
|
||||
private ManagedRepository repositoryConfig;
|
||||
|
||||
@Inject
|
||||
private NexusIndexer indexer;
|
||||
|
||||
@Inject
|
||||
PlexusSisuBridge plexusSisuBridge;
|
||||
|
||||
@Inject
|
||||
MavenIndexerUtils mavenIndexerUtils;
|
||||
List<IndexCreator> indexCreators;
|
||||
|
||||
@Inject
|
||||
ManagedRepositoryAdmin managedRepositoryAdmin;
|
||||
|
||||
@Inject
|
||||
private IndexUpdater indexUpdater;
|
||||
|
||||
@Before
|
||||
@Override
|
||||
public void setUp()
|
||||
|
@ -98,8 +94,6 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
repositoryConfig.setSnapshots( false );
|
||||
repositoryConfig.setReleases( true );
|
||||
|
||||
indexer = plexusSisuBridge.lookup( NexusIndexer.class );
|
||||
|
||||
managedRepositoryAdmin.createIndexContext( repositoryConfig );
|
||||
}
|
||||
|
||||
|
@ -147,19 +141,19 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
|
||||
BooleanQuery q = new BooleanQuery();
|
||||
q.add( indexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "org.apache.archiva" ) ),
|
||||
Occur.SHOULD );
|
||||
BooleanClause.Occur.SHOULD );
|
||||
q.add(
|
||||
indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
|
||||
Occur.SHOULD );
|
||||
BooleanClause.Occur.SHOULD );
|
||||
|
||||
if ( !indexer.getIndexingContexts().containsKey( repositoryConfig.getId() ) )
|
||||
{
|
||||
IndexingContext context = indexer.addIndexingContext( repositoryConfig.getId(), repositoryConfig.getId(),
|
||||
new File( repositoryConfig.getLocation() ),
|
||||
new File( repositoryConfig.getLocation(),
|
||||
".indexer" ), null, null,
|
||||
mavenIndexerUtils.getAllIndexCreators()
|
||||
);
|
||||
IndexingContext context = indexer.addIndexingContext( repositoryConfig.getId(), //
|
||||
repositoryConfig.getId(), //
|
||||
new File( repositoryConfig.getLocation() ), //
|
||||
new File( repositoryConfig.getLocation(), ".indexer" )
|
||||
//
|
||||
, null, null, indexCreators );
|
||||
context.setSearchable( true );
|
||||
}
|
||||
|
||||
|
@ -173,9 +167,9 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
Set<ArtifactInfo> results = response.getResults();
|
||||
|
||||
ArtifactInfo artifactInfo = results.iterator().next();
|
||||
assertEquals( "org.apache.archiva", artifactInfo.groupId );
|
||||
assertEquals( "archiva-index-methods-jar-test", artifactInfo.artifactId );
|
||||
assertEquals( "test-repo", artifactInfo.repository );
|
||||
assertEquals( "org.apache.archiva", artifactInfo.getGroupId() );
|
||||
assertEquals( "archiva-index-methods-jar-test", artifactInfo.getArtifactId() );
|
||||
assertEquals( "test-repo", artifactInfo.getRepository() );
|
||||
|
||||
}
|
||||
|
||||
|
@ -195,10 +189,10 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
|
||||
BooleanQuery q = new BooleanQuery();
|
||||
q.add( indexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "org.apache.archiva" ) ),
|
||||
Occur.SHOULD );
|
||||
BooleanClause.Occur.SHOULD );
|
||||
q.add(
|
||||
indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
|
||||
Occur.SHOULD );
|
||||
BooleanClause.Occur.SHOULD );
|
||||
|
||||
IndexingContext ctx = indexer.getIndexingContexts().get( repositoryConfig.getId() );
|
||||
|
||||
|
@ -231,7 +225,7 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
|
||||
BooleanQuery q = new BooleanQuery();
|
||||
q.add( indexer.constructQuery( MAVEN.GROUP_ID, new SourcedSearchExpression( "org.apache.archiva" ) ),
|
||||
Occur.SHOULD );
|
||||
BooleanClause.Occur.SHOULD );
|
||||
//q.add(
|
||||
// indexer.constructQuery( MAVEN.ARTIFACT_ID, new SourcedSearchExpression( "archiva-index-methods-jar-test" ) ),
|
||||
// Occur.SHOULD );
|
||||
|
@ -258,10 +252,10 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
|
||||
q = new BooleanQuery();
|
||||
q.add( indexer.constructQuery( MAVEN.GROUP_ID, new SourcedSearchExpression( "org.apache.archiva" ) ),
|
||||
Occur.SHOULD );
|
||||
BooleanClause.Occur.SHOULD );
|
||||
q.add( indexer.constructQuery( MAVEN.ARTIFACT_ID,
|
||||
new SourcedSearchExpression( "archiva-index-methods-jar-test" ) ), Occur.SHOULD
|
||||
);
|
||||
new SourcedSearchExpression( "archiva-index-methods-jar-test" ) ),
|
||||
BooleanClause.Occur.SHOULD );
|
||||
|
||||
assertTrue( new File( repositoryConfig.getLocation(), ".indexer" ).exists() );
|
||||
assertFalse( new File( repositoryConfig.getLocation(), ".index" ).exists() );
|
||||
|
@ -315,20 +309,26 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
assertTrue( indexerDirectory.exists() );
|
||||
|
||||
// test packed index file creation
|
||||
assertTrue( new File( indexerDirectory, "nexus-maven-repository-index.zip" ).exists() );
|
||||
assertTrue( new File( indexerDirectory, "nexus-maven-repository-index.properties" ).exists() );
|
||||
assertTrue( new File( indexerDirectory, "nexus-maven-repository-index.gz" ).exists() );
|
||||
//no more zip
|
||||
//Assertions.assertThat(new File( indexerDirectory, "nexus-maven-repository-index.zip" )).exists();
|
||||
Assertions.assertThat( new File( indexerDirectory, "nexus-maven-repository-index.properties" ) ).exists();
|
||||
Assertions.assertThat( new File( indexerDirectory, "nexus-maven-repository-index.gz" ) ).exists();
|
||||
|
||||
// unpack .zip index
|
||||
File destDir = new File( repositoryConfig.getLocation(), ".indexer/tmp" );
|
||||
unzipIndex( indexerDirectory.getPath(), destDir.getPath() );
|
||||
//unzipIndex( indexerDirectory.getPath(), destDir.getPath() );
|
||||
|
||||
DefaultIndexUpdater.FileFetcher fetcher = new DefaultIndexUpdater.FileFetcher( indexerDirectory );
|
||||
IndexUpdateRequest updateRequest = new IndexUpdateRequest( getIndexingContext(), fetcher );
|
||||
//updateRequest.setLocalIndexCacheDir( indexerDirectory );
|
||||
indexUpdater.fetchAndUpdateIndex( updateRequest );
|
||||
|
||||
BooleanQuery q = new BooleanQuery();
|
||||
q.add( indexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "org.apache.archiva" ) ),
|
||||
Occur.SHOULD );
|
||||
BooleanClause.Occur.SHOULD );
|
||||
q.add(
|
||||
indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ),
|
||||
Occur.SHOULD );
|
||||
BooleanClause.Occur.SHOULD );
|
||||
|
||||
FlatSearchRequest request = new FlatSearchRequest( q, getIndexingContext() );
|
||||
FlatSearchResponse response = indexer.searchFlat( request );
|
||||
|
@ -336,42 +336,11 @@ public class ArchivaIndexingTaskExecutorTest
|
|||
Set<ArtifactInfo> results = response.getResults();
|
||||
|
||||
ArtifactInfo artifactInfo = results.iterator().next();
|
||||
assertEquals( "org.apache.archiva", artifactInfo.groupId );
|
||||
assertEquals( "archiva-index-methods-jar-test", artifactInfo.artifactId );
|
||||
assertEquals( "test-repo", artifactInfo.repository );
|
||||
assertEquals( "org.apache.archiva", artifactInfo.getGroupId() );
|
||||
assertEquals( "archiva-index-methods-jar-test", artifactInfo.getArtifactId() );
|
||||
assertEquals( "test-repo", artifactInfo.getRepository() );
|
||||
|
||||
assertEquals( 1, response.getTotalHits() );
|
||||
}
|
||||
|
||||
private void unzipIndex( String indexDir, String destDir )
|
||||
throws IOException
|
||||
{
|
||||
final int buff = 2048;
|
||||
|
||||
Files.createDirectories( Paths.get( destDir ) );
|
||||
|
||||
try (InputStream fin = Files.newInputStream( Paths.get( indexDir, "nexus-maven-repository-index.zip" ) ))
|
||||
{
|
||||
ZipInputStream in = new ZipInputStream( new BufferedInputStream( fin ) );
|
||||
ZipEntry entry;
|
||||
|
||||
while ( ( entry = in.getNextEntry() ) != null )
|
||||
{
|
||||
int count;
|
||||
byte data[] = new byte[buff];
|
||||
try (OutputStream fout = Files.newOutputStream( Paths.get( destDir, entry.getName() ) ))
|
||||
{
|
||||
try (BufferedOutputStream out = new BufferedOutputStream( fout, buff ))
|
||||
{
|
||||
|
||||
while ( ( count = in.read( data, 0, buff ) ) != -1 )
|
||||
{
|
||||
out.write( data, 0, count );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,16 +20,15 @@ package org.apache.archiva.scheduler.indexing;
|
|||
|
||||
import org.apache.archiva.admin.model.beans.RemoteRepository;
|
||||
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.archiva.common.utils.FileUtil;
|
||||
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.maven.index.FlatSearchRequest;
|
||||
import org.apache.maven.index.FlatSearchResponse;
|
||||
import org.apache.maven.index.MAVEN;
|
||||
import org.apache.maven.index.NexusIndexer;
|
||||
import org.apache.maven.index.expr.StringSearchExpression;
|
||||
import org.apache.maven.index_shaded.lucene.search.BooleanClause;
|
||||
import org.apache.maven.index_shaded.lucene.search.BooleanQuery;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
|
@ -75,8 +74,6 @@ public class DownloadRemoteIndexTaskTest
|
|||
DefaultDownloadRemoteIndexScheduler downloadRemoteIndexScheduler;
|
||||
|
||||
@Inject
|
||||
PlexusSisuBridge plexusSisuBridge;
|
||||
|
||||
NexusIndexer nexusIndexer;
|
||||
|
||||
@Before
|
||||
|
@ -90,7 +87,6 @@ public class DownloadRemoteIndexTaskTest
|
|||
this.server.start();
|
||||
this.port = serverConnector.getLocalPort();
|
||||
log.info( "start server on port {}", this.port );
|
||||
nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
|
||||
}
|
||||
|
||||
protected void createContext( Server server, File repositoryDirectory )
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -328,22 +328,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>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-core</artifactId>
|
||||
|
@ -451,11 +435,12 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<reuseForks>false</reuseForks>
|
||||
<includes>
|
||||
<include>**/*Tests.java</include>
|
||||
<include>**/*Test.java</include>
|
||||
</includes>
|
||||
<argLine>-Xmx512m -Xms512m -server -XX:MaxPermSize=256m @{jacocoproperty}</argLine>
|
||||
<argLine>-Xms1024m -Xmx3072m -server -XX:MaxPermSize=256m @{jacocoproperty}</argLine>
|
||||
<systemPropertyVariables>
|
||||
<appserver.base>${project.build.directory}/appserver-base</appserver.base>
|
||||
<plexus.home>${project.build.directory}/appserver-base</plexus.home>
|
||||
|
|
|
@ -23,16 +23,15 @@ import org.apache.archiva.admin.model.RepositoryAdminException;
|
|||
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
|
||||
import org.apache.archiva.admin.model.beans.ManagedRepository;
|
||||
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||
import org.apache.archiva.metadata.model.facets.AuditEvent;
|
||||
import org.apache.archiva.checksum.ChecksumAlgorithm;
|
||||
import org.apache.archiva.checksum.ChecksummedFile;
|
||||
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.archiva.common.utils.VersionComparator;
|
||||
import org.apache.archiva.common.utils.VersionUtil;
|
||||
import org.apache.archiva.maven2.metadata.MavenMetadataReader;
|
||||
import org.apache.archiva.maven2.model.Artifact;
|
||||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||
import org.apache.archiva.metadata.model.facets.AuditEvent;
|
||||
import org.apache.archiva.metadata.model.maven2.MavenArtifactFacet;
|
||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
|
||||
|
@ -125,9 +124,6 @@ public class DefaultRepositoriesService
|
|||
@Inject
|
||||
private PlexusSisuBridge plexusSisuBridge;
|
||||
|
||||
@Inject
|
||||
private MavenIndexerUtils mavenIndexerUtils;
|
||||
|
||||
@Inject
|
||||
private SecuritySystem securitySystem;
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.apache.commons.io.FileUtils;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
||||
import org.apache.cxf.jaxrs.client.WebClient;
|
||||
import org.junit.After;
|
||||
import org.junit.Assume;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -77,6 +78,7 @@ public abstract class AbstractArchivaRestTest
|
|||
|
||||
// END SNIPPET: authz-header
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void chekRepo()
|
||||
{
|
||||
|
@ -102,6 +104,7 @@ public abstract class AbstractArchivaRestTest
|
|||
super.startServer();
|
||||
}
|
||||
|
||||
|
||||
private void removeAppsubFolder( File appServerBase, String folder )
|
||||
throws Exception
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ public class MavenIndexerCleaner
|
|||
Logger log = LoggerFactory.getLogger( getClass() );
|
||||
|
||||
@Inject
|
||||
private PlexusSisuBridge plexusSisuBridge;
|
||||
private NexusIndexer nexusIndexer;
|
||||
|
||||
@PreDestroy
|
||||
public void shutdown()
|
||||
|
@ -45,7 +45,6 @@ public class MavenIndexerCleaner
|
|||
{
|
||||
|
||||
log.info( "cleanup IndexingContext" );
|
||||
NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
|
||||
for ( IndexingContext context : nexusIndexer.getIndexingContexts().values() )
|
||||
{
|
||||
nexusIndexer.removeIndexingContext( context, true );
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
<property name="queue" ref="taskQueue#repository-scanning"/>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
<bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown">
|
||||
<constructor-arg ref="config"/>
|
||||
</bean>
|
||||
|
@ -83,6 +84,7 @@
|
|||
<constructor-arg value="${basedir}/src/test/repository.xml"/>
|
||||
<constructor-arg value="${appserver.base}/jcr"/>
|
||||
</bean>
|
||||
-->
|
||||
|
||||
<bean name="commons-configuration" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry"
|
||||
init-method="initialize">
|
||||
|
|
|
@ -368,21 +368,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>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
|
@ -509,7 +494,8 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>-Xmx1024m -Xms512m -XX:MaxPermSize=256m @{jacocoproperty}</argLine>
|
||||
<reuseForks>false</reuseForks>
|
||||
<argLine>-Xms1024m -Xmx2048m -server -XX:MaxPermSize=256m @{jacocoproperty}</argLine>
|
||||
<systemPropertyVariables>
|
||||
<appserver.base>${project.build.directory}/appserver-base</appserver.base>
|
||||
<plexus.home>${project.build.directory}/appserver-base</plexus.home>
|
||||
|
|
|
@ -53,8 +53,6 @@ public class ArchivaStartup
|
|||
|
||||
private DefaultRepositoryArchivaTaskScheduler repositoryTaskScheduler;
|
||||
|
||||
private PlexusSisuBridge plexusSisuBridge;
|
||||
|
||||
private NexusIndexer nexusIndexer;
|
||||
|
||||
@Override
|
||||
|
@ -74,16 +72,8 @@ public class ArchivaStartup
|
|||
|
||||
tqeIndexing = wac.getBean( "taskQueueExecutor#indexing", ThreadedTaskQueueExecutor.class );
|
||||
|
||||
plexusSisuBridge = wac.getBean( PlexusSisuBridge.class );
|
||||
nexusIndexer = wac.getBean( NexusIndexer.class );
|
||||
|
||||
try
|
||||
{
|
||||
nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
|
||||
}
|
||||
catch ( PlexusSisuBridgeException e )
|
||||
{
|
||||
throw new RuntimeException( "Unable to get NexusIndexer: " + e.getMessage(), e );
|
||||
}
|
||||
try
|
||||
{
|
||||
securitySync.startup();
|
||||
|
|
|
@ -58,4 +58,10 @@ public class TestRepositorySessionFactoryBean
|
|||
logger.info( "create RepositorySessionFactory instance of {}", repositorySessionFactory.getClass().getName() );
|
||||
return repositorySessionFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId()
|
||||
{
|
||||
return this.beanId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,4 +55,10 @@ public class TestRepositorySessionFactory
|
|||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
// no op
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
<property name="queue" ref="taskQueue#repository-scanning"/>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
<bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown">
|
||||
<constructor-arg ref="config"/>
|
||||
</bean>
|
||||
|
@ -79,6 +80,7 @@
|
|||
<constructor-arg value="${basedir}/src/test/repository.xml"/>
|
||||
<constructor-arg value="${appserver.base}/jcr"/>
|
||||
</bean>
|
||||
-->
|
||||
|
||||
<alias name="repositorySessionFactory#jcr" alias="repositorySessionFactory"/>
|
||||
<alias name="userConfiguration#archiva" alias="userConfiguration#default"/>
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
|
||||
<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: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/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/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
|
||||
default-lazy-init="true">
|
||||
|
||||
<!--
|
||||
<bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown">
|
||||
<constructor-arg ref="config"/>
|
||||
</bean>
|
||||
|
@ -35,6 +35,7 @@
|
|||
<constructor-arg value="${basedir}/src/test/repository.xml"/>
|
||||
<constructor-arg value="${appserver.base}/jcr"/>
|
||||
</bean>
|
||||
-->
|
||||
|
||||
<alias name="repositorySessionFactory#jcr" alias="repositorySessionFactory"/>
|
||||
|
||||
|
|
|
@ -130,29 +130,6 @@
|
|||
<artifactId>metadata-store-cassandra</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-jcr-commons</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-core</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-dbcp</groupId>
|
||||
<artifactId>commons-dbcp</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-configuration</groupId>
|
||||
<artifactId>commons-configuration</artifactId>
|
||||
|
@ -278,6 +255,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.maven.indexer</groupId>
|
||||
<artifactId>indexer-core</artifactId>
|
||||
<classifier>shaded-lucene</classifier>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
|
@ -811,8 +789,6 @@
|
|||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -928,8 +904,7 @@
|
|||
<webApp>
|
||||
<contextPath>/archiva</contextPath>
|
||||
</webApp>
|
||||
<jettyXml>${basedir}/src/test/jetty/jetty-env.xml</jettyXml>
|
||||
|
||||
<jettyXml>${basedir}/src/test/jetty-env.xml</jettyXml>
|
||||
<systemProperties>
|
||||
<systemProperty>
|
||||
<name>plexus.home</name>
|
||||
|
@ -945,7 +920,7 @@
|
|||
</systemProperty>
|
||||
<systemProperty>
|
||||
<name>derby.system.home</name>
|
||||
<value>${archivaAppServerBase}/logs</value>
|
||||
<value>${archivaAppServerBase}/database</value>
|
||||
</systemProperty>
|
||||
<systemProperty>
|
||||
<name>java.io.tmpdir</name>
|
||||
|
@ -979,6 +954,10 @@
|
|||
<name>archiva.repositorySessionFactory.id</name>
|
||||
<value>${archiva.repositorySessionFactory.id}</value>
|
||||
</systemProperty>
|
||||
<systemProperty>
|
||||
<name>log4j.configurationFile</name>
|
||||
<value>${basedir}/src/test/log4j2-test.xml</value>
|
||||
</systemProperty>
|
||||
<systemProperty>
|
||||
<name>AsyncLoggerConfig.WaitStrategy</name>
|
||||
<value>Block</value>
|
||||
|
@ -1025,7 +1004,6 @@
|
|||
<artifactId>serp</artifactId>
|
||||
<version>1.15.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-io</artifactId>
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
<util:properties id="archivaRuntimeProperties" location="classpath:application.properties" />
|
||||
|
||||
<!--
|
||||
<bean id="jcr-repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown" lazy-init="true">
|
||||
<constructor-arg ref="jcr-config"/>
|
||||
</bean>
|
||||
|
@ -46,7 +47,7 @@
|
|||
<constructor-arg value="${appserver.base}/conf/repository.xml"/>
|
||||
<constructor-arg value="${appserver.base}/data/jcr"/>
|
||||
</bean>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<jee:jndi-lookup id="dataSource" jndi-name="java:/comp/env/jdbc/users" />
|
||||
|
|
|
@ -78,12 +78,6 @@
|
|||
|
||||
<logger name="org.quartz" level="info"/>
|
||||
|
||||
<logger name="org.apache.jasper" level="info"/>
|
||||
|
||||
<logger name="com.opensymphony.xwork2" level="info"/>
|
||||
|
||||
<logger name="org.apache.struts2" level="info"/>
|
||||
|
||||
-->
|
||||
|
||||
<!-- WebDav objects -->
|
||||
|
|
|
@ -94,20 +94,6 @@
|
|||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-filelock</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-webdav</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-jcr-commons</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
|
@ -116,6 +102,10 @@
|
|||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-webdav</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
|
@ -302,8 +292,6 @@
|
|||
org.apache.archiva.metadata.repository.storage;version=${project.version},
|
||||
org.apache.commons.io;version="[1.4,2)",
|
||||
org.apache.commons.lang;version="[2.4,3)",
|
||||
org.apache.jackrabbit.util;version="[1,3)",
|
||||
org.apache.jackrabbit.webdav*;version="[1,3)",
|
||||
org.joda.time*;version="[1.5,2)",
|
||||
org.springframework*;version="[3,4)",
|
||||
org.apache.maven.index*,
|
||||
|
|
|
@ -18,23 +18,18 @@ package org.apache.archiva.webdav.util;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
|
||||
import org.apache.maven.index.NexusIndexer;
|
||||
import org.apache.maven.index.context.IndexingContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.inject.Inject;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Olivier Lamy
|
||||
|
@ -46,15 +41,16 @@ public class MavenIndexerCleaner
|
|||
Logger log = LoggerFactory.getLogger( getClass() );
|
||||
|
||||
|
||||
private PlexusSisuBridge plexusSisuBridge;
|
||||
|
||||
@Inject
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Inject
|
||||
NexusIndexer nexusIndexer;
|
||||
|
||||
@PostConstruct
|
||||
public void startup()
|
||||
{
|
||||
plexusSisuBridge = applicationContext.getBean( PlexusSisuBridge.class );
|
||||
cleanupIndex();
|
||||
}
|
||||
|
||||
|
@ -70,9 +66,6 @@ public class MavenIndexerCleaner
|
|||
{
|
||||
try
|
||||
{
|
||||
WebApplicationContext wacu =
|
||||
WebApplicationContextUtils.getRequiredWebApplicationContext( servletContextEvent.getServletContext() );
|
||||
plexusSisuBridge = wacu.getBean( PlexusSisuBridge.class );
|
||||
cleanupIndex();
|
||||
|
||||
}
|
||||
|
@ -103,7 +96,6 @@ public class MavenIndexerCleaner
|
|||
log.info( "cleanup IndexingContext" );
|
||||
try
|
||||
{
|
||||
NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
|
||||
for ( IndexingContext context : nexusIndexer.getIndexingContexts().values() )
|
||||
{
|
||||
nexusIndexer.removeIndexingContext( context, true );
|
||||
|
|
|
@ -22,4 +22,6 @@ package org.apache.archiva.metadata.repository;
|
|||
public interface RepositorySessionFactory
|
||||
{
|
||||
RepositorySession createSession();
|
||||
|
||||
void close();
|
||||
}
|
||||
|
|
|
@ -827,14 +827,7 @@ public abstract class AbstractMetadataRepositoryTest
|
|||
Collection<ArtifactMetadata> artifacts =
|
||||
repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
|
||||
ArrayList<ArtifactMetadata> actual = new ArrayList<>( artifacts );
|
||||
Collections.sort( actual, new Comparator<ArtifactMetadata>()
|
||||
{
|
||||
@Override
|
||||
public int compare( ArtifactMetadata o1, ArtifactMetadata o2 )
|
||||
{
|
||||
return o1.getId().compareTo( o2.getId() );
|
||||
}
|
||||
} );
|
||||
Collections.sort( actual,( o1, o2 ) -> o1.getId().compareTo( o2.getId() ) );
|
||||
assertEquals( Arrays.asList( artifact1, artifact2 ), actual );
|
||||
}
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@
|
|||
<executions>
|
||||
<execution>
|
||||
<id>test-repository</id>
|
||||
<phase>generate-test-resources</phase>
|
||||
<phase>process-test-classes</phase>
|
||||
<goals>
|
||||
<goal>unpack-dependencies</goal>
|
||||
</goals>
|
||||
|
|
|
@ -82,4 +82,10 @@ public class CassandraRepositorySessionFactory
|
|||
return new RepositorySession( metadataRepository, metadataResolver );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
cassandraArchivaManager.shutdown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,21 +42,12 @@ import java.util.Map;
|
|||
public class FileRepositorySessionFactory
|
||||
implements RepositorySessionFactory
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Map<String, MetadataFacetFactory> metadataFacetFactories;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Inject
|
||||
@Named( value = "archivaConfiguration#default" )
|
||||
private ArchivaConfiguration configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Inject
|
||||
private MetadataResolver metadataResolver;
|
||||
|
||||
|
@ -87,4 +78,10 @@ public class FileRepositorySessionFactory
|
|||
|
||||
return new RepositorySession( metadataRepository, metadataResolver );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
// no op
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,12 @@
|
|||
<artifactId>archiva-test-utils</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.jcr</groupId>
|
||||
|
@ -59,24 +65,39 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-jcr-commons</artifactId>
|
||||
<artifactId>oak-jcr</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
<!-- could trim more, but since it's just for test we don't need to worry -->
|
||||
<artifactId>oak-segment-tar</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-lucene</artifactId>
|
||||
<version>${jcr-oak.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-misc</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-facet</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-jcl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
|
@ -102,6 +123,57 @@
|
|||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-core</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-misc</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-facet</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-codecs</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-queryparser</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-sandbox</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-highlighter</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-memory</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-analyzers-common</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.dropwizard.metrics</groupId>
|
||||
<artifactId>metrics-core</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<testResources>
|
||||
|
@ -134,8 +206,6 @@
|
|||
org.apache.archiva.metadata.model;version=${project.version},
|
||||
org.apache.archiva.metadata.repository;version=${project.version},
|
||||
org.apache.commons.lang;version="[2.4,3)",
|
||||
org.apache.jackrabbit.commons;version="[2.3,3)",
|
||||
org.apache.jackrabbit.core.config,
|
||||
org.springframework*;version="[3,4)",
|
||||
org.slf4j;resolution:=optional,
|
||||
org.apache.commons.lang.time
|
||||
|
@ -143,6 +213,15 @@
|
|||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<appserver.base>${project.build.directory}/jcr/repo</appserver.base>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
package org.apache.archiva.metadata.repository.jcr;
|
||||
/*
|
||||
* 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.jackrabbit.core.config.ConfigurationException;
|
||||
import org.apache.jackrabbit.core.config.RepositoryConfig;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author Olivier Lamy
|
||||
* @since 1.4-M1
|
||||
*/
|
||||
public class ArchivaJcrRepositoryConfig
|
||||
{
|
||||
// Recommended to avoid inconsistencies caused by race conditions.
|
||||
static
|
||||
{
|
||||
if ( !System.getProperties( ).containsKey( "org.apache.jackrabbit.core.state.validatehierarchy" ) )
|
||||
{
|
||||
System.setProperty( "org.apache.jackrabbit.core.state.validatehierarchy", "true" );
|
||||
}
|
||||
}
|
||||
|
||||
public static RepositoryConfig create( String file, String home )
|
||||
throws ConfigurationException
|
||||
{
|
||||
File homeFile = new File( home );
|
||||
if ( !homeFile.exists( ) )
|
||||
{
|
||||
homeFile.mkdirs( );
|
||||
}
|
||||
|
||||
File configurationFile = new File( file );
|
||||
if ( !configurationFile.exists( ) )
|
||||
{
|
||||
String resourcePath = "org/apache/archiva/metadata/repository/jcr/repository.xml";
|
||||
LoggerFactory.getLogger( ArchivaJcrRepositoryConfig.class ).info(
|
||||
"no repository.xml file in path {} so use default from resources path {}", file, resourcePath );
|
||||
// use bundled repository.xml
|
||||
return RepositoryConfig.create(
|
||||
Thread.currentThread( ).getContextClassLoader( ).getResourceAsStream( resourcePath ), home );
|
||||
}
|
||||
|
||||
return RepositoryConfig.create( file, home );
|
||||
}
|
||||
}
|
|
@ -40,6 +40,8 @@ import org.apache.archiva.metadata.repository.stats.model.RepositoryStatistics;
|
|||
import org.apache.archiva.metadata.repository.stats.model.RepositoryStatisticsProvider;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.jackrabbit.commons.JcrUtils;
|
||||
import org.apache.jackrabbit.oak.plugins.index.IndexUtils;
|
||||
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -143,6 +145,8 @@ public class JcrMetadataRepository
|
|||
registerMixinNodeType( nodeTypeManager, JcrMetadataRepository.FACET_NODE_TYPE );
|
||||
registerMixinNodeType( nodeTypeManager, JcrMetadataRepository.DEPENDENCY_NODE_TYPE );
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void registerMixinNodeType( NodeTypeManager nodeTypeManager, String name )
|
||||
|
@ -160,6 +164,8 @@ public class JcrMetadataRepository
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void updateProject( String repositoryId, ProjectMetadata project )
|
||||
throws MetadataRepositoryException
|
||||
|
@ -759,6 +765,10 @@ public class JcrMetadataRepository
|
|||
{
|
||||
throw new MetadataRepositoryException( e.getMessage(), e );
|
||||
}
|
||||
log.info("Artifacts found {}", artifacts.size());
|
||||
for (ArtifactMetadata meta : artifacts) {
|
||||
log.info("Artifact: "+meta.getVersion()+" "+meta.getFacetList());
|
||||
}
|
||||
return artifacts;
|
||||
}
|
||||
|
||||
|
@ -1422,11 +1432,9 @@ public class JcrMetadataRepository
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ArtifactMetadata> searchArtifacts( String key, String text, String repositoryId, boolean exact )
|
||||
public List<ArtifactMetadata> searchArtifacts( String key, String text, String repositoryId, boolean e )
|
||||
throws MetadataRepositoryException
|
||||
{
|
||||
// we can't do exact search in any property (*), we need a key
|
||||
boolean e = exact && key != null;
|
||||
String theKey = key == null ? "*" : "[" + key + "]";
|
||||
String projectVersionCondition =
|
||||
e ? "(projectVersion." + theKey + " = $value)" : "contains([projectVersion]." + theKey + ", $value)";
|
||||
|
@ -1436,7 +1444,6 @@ public class JcrMetadataRepository
|
|||
+ ARTIFACT_NODE_TYPE + "] AS artifact ON ISCHILDNODE(artifact, projectVersion) LEFT OUTER JOIN ["
|
||||
+ FACET_NODE_TYPE + "] AS facet ON ISCHILDNODE(facet, projectVersion) WHERE ("
|
||||
+ projectVersionCondition + " OR " + facetCondition + ")";
|
||||
|
||||
return runJcrQuery( repositoryId, q, ImmutableMap.of( "value", text ) );
|
||||
}
|
||||
|
||||
|
@ -1559,7 +1566,7 @@ public class JcrMetadataRepository
|
|||
|
||||
private static String getRepositoryContentPath( String repositoryId )
|
||||
{
|
||||
return getRepositoryPath( repositoryId ) + "/content/";
|
||||
return getRepositoryPath( repositoryId ) + "/content";
|
||||
}
|
||||
|
||||
private static String getFacetPath( String repositoryId, String facetId )
|
||||
|
@ -1569,7 +1576,7 @@ public class JcrMetadataRepository
|
|||
|
||||
private static String getNamespacePath( String repositoryId, String namespace )
|
||||
{
|
||||
return getRepositoryContentPath( repositoryId ) + namespace.replace( '.', '/' );
|
||||
return getRepositoryContentPath( repositoryId ) + "/" + namespace.replace( '.', '/' );
|
||||
}
|
||||
|
||||
private static String getProjectPath( String repositoryId, String namespace, String projectId )
|
||||
|
@ -1598,6 +1605,7 @@ public class JcrMetadataRepository
|
|||
private Node getOrAddNodeByPath( Node baseNode, String name, String nodeType )
|
||||
throws RepositoryException
|
||||
{
|
||||
log.debug("getOrAddNodeByPath"+baseNode+" "+name+" "+nodeType);
|
||||
Node node = baseNode;
|
||||
for ( String n : name.split( "/" ) )
|
||||
{
|
||||
|
@ -1618,8 +1626,10 @@ public class JcrMetadataRepository
|
|||
private Node getOrAddRepositoryNode( String repositoryId )
|
||||
throws RepositoryException
|
||||
{
|
||||
log.debug("getOrAddRepositoryNode "+repositoryId);
|
||||
Node root = getJcrSession().getRootNode();
|
||||
Node node = JcrUtils.getOrAddNode( root, "repositories" );
|
||||
log.debug("Repositories "+node);
|
||||
node = JcrUtils.getOrAddNode( node, repositoryId );
|
||||
return node;
|
||||
}
|
||||
|
|
|
@ -33,16 +33,19 @@ import org.springframework.context.ApplicationContext;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.inject.Inject;
|
||||
import javax.jcr.Repository;
|
||||
import javax.jcr.RepositoryException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Service("repositorySessionFactory#jcr")
|
||||
@Service( "repositorySessionFactory#jcr" )
|
||||
public class JcrRepositorySessionFactory
|
||||
implements RepositorySessionFactory
|
||||
{
|
||||
|
@ -54,7 +57,6 @@ public class JcrRepositorySessionFactory
|
|||
|
||||
private Map<String, MetadataFacetFactory> metadataFacetFactories;
|
||||
|
||||
@Inject
|
||||
private Repository repository;
|
||||
|
||||
// Lazy evaluation to avoid problems with circular dependencies during initialization
|
||||
|
@ -63,6 +65,8 @@ public class JcrRepositorySessionFactory
|
|||
@Inject
|
||||
private RepositorySessionFactoryBean repositorySessionFactoryBean;
|
||||
|
||||
private RepositoryFactory repositoryFactory;
|
||||
|
||||
@Override
|
||||
public RepositorySession createSession()
|
||||
{
|
||||
|
@ -85,8 +89,10 @@ public class JcrRepositorySessionFactory
|
|||
}
|
||||
|
||||
// Lazy evaluation to avoid problems with circular dependencies during initialization
|
||||
private MetadataResolver getMetadataResolver() {
|
||||
if (this.metadataResolver==null) {
|
||||
private MetadataResolver getMetadataResolver()
|
||||
{
|
||||
if ( this.metadataResolver == null )
|
||||
{
|
||||
this.metadataResolver = applicationContext.getBean( MetadataResolver.class );
|
||||
}
|
||||
return this.metadataResolver;
|
||||
|
@ -97,7 +103,7 @@ public class JcrRepositorySessionFactory
|
|||
throws Exception
|
||||
{
|
||||
|
||||
// skip initialisation if not cassandra
|
||||
// skip initialisation if not jcr
|
||||
if ( !StringUtils.equals( repositorySessionFactoryBean.getId(), "jcr" ) )
|
||||
{
|
||||
return;
|
||||
|
@ -123,6 +129,12 @@ public class JcrRepositorySessionFactory
|
|||
JcrMetadataRepository metadataRepository = null;
|
||||
try
|
||||
{
|
||||
|
||||
repositoryFactory = new RepositoryFactory();
|
||||
// FIXME this need to be configurable
|
||||
Path directoryPath = Paths.get( System.getProperty( "appserver.base" ), "data/jcr" );
|
||||
repositoryFactory.setRepositoryPath( directoryPath );
|
||||
repository = repositoryFactory.createRepository();
|
||||
metadataRepository = new JcrMetadataRepository( metadataFacetFactories, repository );
|
||||
JcrMetadataRepository.initialize( metadataRepository.getJcrSession() );
|
||||
}
|
||||
|
@ -141,4 +153,10 @@ public class JcrRepositorySessionFactory
|
|||
stopWatch.stop();
|
||||
logger.info( "time to initialize JcrRepositorySessionFactory: {}", stopWatch.getTime() );
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void close()
|
||||
{
|
||||
repositoryFactory.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,350 @@
|
|||
package org.apache.archiva.metadata.repository.jcr;
|
||||
|
||||
/*
|
||||
* 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 com.google.common.collect.ImmutableSet;
|
||||
import org.apache.commons.lang.time.StopWatch;
|
||||
import org.apache.jackrabbit.JcrConstants;
|
||||
import org.apache.jackrabbit.oak.Oak;
|
||||
import org.apache.jackrabbit.oak.api.Type;
|
||||
import org.apache.jackrabbit.oak.jcr.Jcr;
|
||||
import org.apache.jackrabbit.oak.plugins.index.IndexUtils;
|
||||
import org.apache.jackrabbit.oak.plugins.index.lucene.ExtractedTextCache;
|
||||
import org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier;
|
||||
import org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker;
|
||||
import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider;
|
||||
import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider;
|
||||
import org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.DocumentQueue;
|
||||
import org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.LocalIndexObserver;
|
||||
import org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.NRTIndexFactory;
|
||||
import org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory;
|
||||
import org.apache.jackrabbit.oak.segment.SegmentNodeStoreBuilders;
|
||||
import org.apache.jackrabbit.oak.segment.file.FileStore;
|
||||
import org.apache.jackrabbit.oak.segment.file.FileStoreBuilder;
|
||||
import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException;
|
||||
import org.apache.jackrabbit.oak.spi.commit.Observer;
|
||||
import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
|
||||
import org.apache.jackrabbit.oak.spi.mount.MountInfoProvider;
|
||||
import org.apache.jackrabbit.oak.spi.mount.Mounts;
|
||||
import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
|
||||
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
|
||||
import org.apache.jackrabbit.oak.spi.state.NodeStore;
|
||||
import org.apache.jackrabbit.oak.stats.StatisticsProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.jcr.Repository;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import static org.apache.archiva.metadata.repository.jcr.RepositoryFactory.StoreType.IN_MEMORY_TYPE;
|
||||
import static org.apache.archiva.metadata.repository.jcr.RepositoryFactory.StoreType.SEGMENT_FILE_TYPE;
|
||||
import static org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexConstants.INCLUDE_PROPERTY_TYPES;
|
||||
|
||||
/**
|
||||
* Created by martin on 14.06.17.
|
||||
*
|
||||
* @author Martin Stockhammer
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public class RepositoryFactory
|
||||
{
|
||||
|
||||
private Logger log = LoggerFactory.getLogger( RepositoryFactory.class );
|
||||
|
||||
private FileStore fileStore;
|
||||
|
||||
private NodeStore nodeStore;
|
||||
|
||||
private ExecutorService executorService;
|
||||
|
||||
public enum StoreType
|
||||
{
|
||||
SEGMENT_FILE_TYPE,
|
||||
IN_MEMORY_TYPE;
|
||||
}
|
||||
|
||||
private StoreType storeType = SEGMENT_FILE_TYPE;
|
||||
|
||||
private Path repositoryPath = Paths.get( "repository" );
|
||||
|
||||
public Repository createRepository()
|
||||
throws IOException, InvalidFileStoreVersionException
|
||||
{
|
||||
createExecutor();
|
||||
|
||||
if ( SEGMENT_FILE_TYPE == storeType )
|
||||
{
|
||||
fileStore = FileStoreBuilder.fileStoreBuilder( repositoryPath.toFile() ).build();
|
||||
nodeStore = SegmentNodeStoreBuilders.builder( fileStore ) //
|
||||
.withStatisticsProvider( StatisticsProvider.NOOP ) //
|
||||
.build();
|
||||
}
|
||||
else if ( IN_MEMORY_TYPE == storeType )
|
||||
{
|
||||
nodeStore = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException( "Store type " + storeType + " not recognized" );
|
||||
}
|
||||
|
||||
Oak oak = nodeStore == null ? new Oak() : new Oak( nodeStore );
|
||||
oak.with( new RepositoryInitializer()
|
||||
{
|
||||
@Override
|
||||
public void initialize( @Nonnull NodeBuilder root )
|
||||
{
|
||||
log.info( "Creating index " );
|
||||
|
||||
NodeBuilder lucene = IndexUtils.getOrCreateOakIndex( root ).child( "lucene" );
|
||||
lucene.setProperty( JcrConstants.JCR_PRIMARYTYPE, "oak:QueryIndexDefinition", Type.NAME );
|
||||
|
||||
lucene.setProperty( "compatVersion", 2 );
|
||||
lucene.setProperty( "type", "lucene" );
|
||||
// lucene.setProperty("async", "async");
|
||||
lucene.setProperty( INCLUDE_PROPERTY_TYPES, ImmutableSet.of( "String" ), Type.STRINGS );
|
||||
// lucene.setProperty("refresh",true);
|
||||
lucene.setProperty( "async", ImmutableSet.of( "async", "sync" ), Type.STRINGS );
|
||||
NodeBuilder rules = lucene.child( "indexRules" ).
|
||||
setProperty( JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME );
|
||||
rules.setProperty( ":childOrder", ImmutableSet.of( "archiva:projectVersion", //
|
||||
"archiva:artifact", //
|
||||
"archiva:facet", //
|
||||
"archiva:namespace", //
|
||||
"archiva:project" ), //
|
||||
Type.STRINGS );
|
||||
NodeBuilder allProps = rules.child( "archiva:projectVersion" ) //
|
||||
.child( "properties" ) //
|
||||
.setProperty( JcrConstants.JCR_PRIMARYTYPE, "nt:unstructured", Type.NAME ) //
|
||||
.setProperty( ":childOrder", ImmutableSet.of( "allProps" ), Type.STRINGS ) //
|
||||
.setProperty( "indexNodeName", true ) //
|
||||
.child( "allProps" ) //
|
||||
.setProperty( JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME );
|
||||
allProps.setProperty( "name", ".*" );
|
||||
allProps.setProperty( "isRegexp", true );
|
||||
allProps.setProperty( "nodeScopeIndex", true );
|
||||
allProps.setProperty( "index", true );
|
||||
allProps.setProperty( "analyzed", true );
|
||||
// allProps.setProperty("propertyIndex",true);
|
||||
allProps = rules.child( "archiva:artifact" ) //
|
||||
.child( "properties" ) //
|
||||
.setProperty( JcrConstants.JCR_PRIMARYTYPE, "nt:unstructured", Type.NAME ) //
|
||||
.setProperty( ":childOrder", ImmutableSet.of( "allProps" ), Type.STRINGS ) //
|
||||
.setProperty( "indexNodeName", true ).child( "allProps" ) //
|
||||
.setProperty( JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME );
|
||||
allProps.setProperty( "name", ".*" );
|
||||
allProps.setProperty( "isRegexp", true );
|
||||
allProps.setProperty( "nodeScopeIndex", true );
|
||||
allProps.setProperty( "index", true );
|
||||
allProps.setProperty( "analyzed", true );
|
||||
allProps = rules.child( "archiva:facet" ) //
|
||||
.child( "properties" ) //
|
||||
.setProperty( JcrConstants.JCR_PRIMARYTYPE, "nt:unstructured", Type.NAME ) //
|
||||
.setProperty( ":childOrder", ImmutableSet.of( "allProps" ), Type.STRINGS ) //
|
||||
.setProperty( "indexNodeName", true ) //
|
||||
.child( "allProps" ) //
|
||||
.setProperty( JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME );
|
||||
allProps.setProperty( "name", ".*" );
|
||||
allProps.setProperty( "isRegexp", true );
|
||||
allProps.setProperty( "nodeScopeIndex", true );
|
||||
allProps.setProperty( "index", true );
|
||||
allProps.setProperty( "analyzed", true );
|
||||
allProps = rules.child( "archiva:namespace" ) //
|
||||
.child( "properties" ) //
|
||||
.setProperty( JcrConstants.JCR_PRIMARYTYPE, "nt:unstructured", Type.NAME ) //
|
||||
.setProperty( ":childOrder", ImmutableSet.of( "allProps" ), Type.STRINGS ) //
|
||||
.setProperty( "indexNodeName", true ) //
|
||||
.child( "allProps" ) //
|
||||
.setProperty( JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME );
|
||||
allProps.setProperty( "name", ".*" );
|
||||
allProps.setProperty( "isRegexp", true );
|
||||
allProps.setProperty( "nodeScopeIndex", true );
|
||||
allProps.setProperty( "index", true );
|
||||
allProps.setProperty( "analyzed", true );
|
||||
allProps = rules.child( "archiva:project" ) //
|
||||
.child( "properties" ) //
|
||||
.setProperty( JcrConstants.JCR_PRIMARYTYPE, "nt:unstructured", Type.NAME ) //
|
||||
.setProperty( ":childOrder", ImmutableSet.of( "allProps" ), Type.STRINGS ) //
|
||||
.setProperty( "indexNodeName", true ) //
|
||||
.child( "allProps" ) //
|
||||
.setProperty( JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME );
|
||||
allProps.setProperty( "name", ".*" );
|
||||
allProps.setProperty( "isRegexp", true );
|
||||
allProps.setProperty( "nodeScopeIndex", true );
|
||||
allProps.setProperty( "index", true );
|
||||
allProps.setProperty( "analyzed", true );
|
||||
|
||||
log.info( "Index: {} myIndex {}", lucene, lucene.getChildNode( "myIndex" ) );
|
||||
log.info( "myIndex {}", lucene.getChildNode( "myIndex" ).getProperties() );
|
||||
// IndexUtils.createIndexDefinition( )
|
||||
|
||||
}
|
||||
} );
|
||||
|
||||
StatisticsProvider statsProvider = StatisticsProvider.NOOP;
|
||||
int queueSize = Integer.getInteger( "queueSize", 10000 );
|
||||
File indexDir = Files.createTempDirectory( "archiva_index" ).toFile();
|
||||
log.info( "Queue Index {}", indexDir.toString() );
|
||||
IndexCopier indexCopier = new IndexCopier( executorService, indexDir, true );
|
||||
NRTIndexFactory nrtIndexFactory = new NRTIndexFactory( indexCopier, statsProvider );
|
||||
MountInfoProvider mountInfoProvider = Mounts.defaultMountInfoProvider();
|
||||
IndexTracker tracker =
|
||||
new IndexTracker( new DefaultIndexReaderFactory( mountInfoProvider, indexCopier ), nrtIndexFactory );
|
||||
DocumentQueue queue = new DocumentQueue( queueSize, tracker, executorService, statsProvider );
|
||||
LocalIndexObserver localIndexObserver = new LocalIndexObserver( queue, statsProvider );
|
||||
LuceneIndexProvider provider = new LuceneIndexProvider( tracker );
|
||||
|
||||
// ExternalObserverBuilder builder = new ExternalObserverBuilder(queue, tracker, statsProvider,
|
||||
// executorService, queueSize);
|
||||
// Observer observer = builder.build();
|
||||
// builder.getBackgroundObserver();
|
||||
|
||||
LuceneIndexEditorProvider editorProvider = //
|
||||
new LuceneIndexEditorProvider( null, tracker, //
|
||||
new ExtractedTextCache( 0, 0 ), //
|
||||
null, mountInfoProvider );
|
||||
editorProvider.setIndexingQueue( queue );
|
||||
|
||||
log.info( "Oak: {} with nodeStore {}", oak, nodeStore );
|
||||
Jcr jcr = new Jcr( oak ).with( editorProvider ) //
|
||||
.with( (Observer) provider ) //
|
||||
.with( localIndexObserver )
|
||||
// .with(observer)
|
||||
.with( (QueryIndexProvider) provider ); //
|
||||
//.withAsyncIndexing( "async", 5 );
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start();
|
||||
Repository r = jcr.createRepository();
|
||||
stopWatch.stop();
|
||||
log.info( "time to create jcr repository: {} ms", stopWatch.getTime() );
|
||||
// try
|
||||
// {
|
||||
// Thread.currentThread().sleep( 1000 );
|
||||
// }
|
||||
// catch ( InterruptedException e )
|
||||
// {
|
||||
// log.error( e.getMessage(), e );
|
||||
// }
|
||||
return r;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void close()
|
||||
{
|
||||
if ( fileStore != null )
|
||||
{
|
||||
fileStore.close();
|
||||
}
|
||||
if (executorService != null)
|
||||
{
|
||||
executorService.shutdownNow();
|
||||
}
|
||||
}
|
||||
|
||||
public StoreType getStoreType()
|
||||
{
|
||||
return storeType;
|
||||
}
|
||||
|
||||
public void setStoreType( StoreType storeType )
|
||||
{
|
||||
this.storeType = storeType;
|
||||
}
|
||||
|
||||
public Path getRepositoryPath()
|
||||
{
|
||||
return repositoryPath;
|
||||
}
|
||||
|
||||
public void setRepositoryPath( Path repositoryPath )
|
||||
{
|
||||
this.repositoryPath = repositoryPath;
|
||||
}
|
||||
|
||||
public void setRepositoryPath( String repositoryPath )
|
||||
{
|
||||
this.repositoryPath = Paths.get( repositoryPath );
|
||||
if ( !Files.exists( this.repositoryPath ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
Files.createDirectories( this.repositoryPath );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new IllegalArgumentException( "cannot create directory:" + repositoryPath, e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createExecutor()
|
||||
{
|
||||
if (executorService ==null )
|
||||
{
|
||||
executorService = Executors.newCachedThreadPool();
|
||||
}
|
||||
|
||||
//
|
||||
// ThreadPoolExecutor executor =
|
||||
// new ThreadPoolExecutor( 0, 5, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),
|
||||
// new ThreadFactory()
|
||||
// {
|
||||
// private final AtomicInteger counter = new AtomicInteger();
|
||||
//
|
||||
// private final Thread.UncaughtExceptionHandler handler =
|
||||
// new Thread.UncaughtExceptionHandler()
|
||||
// {
|
||||
// @Override
|
||||
// public void uncaughtException( Thread t, Throwable e )
|
||||
// {
|
||||
// log.warn( "Error occurred in asynchronous processing ", e );
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// @Override
|
||||
// public Thread newThread( @Nonnull Runnable r )
|
||||
// {
|
||||
// Thread thread = new Thread( r, createName() );
|
||||
// thread.setDaemon( true );
|
||||
// thread.setPriority( Thread.MIN_PRIORITY );
|
||||
// thread.setUncaughtExceptionHandler( handler );
|
||||
// return thread;
|
||||
// }
|
||||
//
|
||||
// private String createName()
|
||||
// {
|
||||
// return "oak-lucene-" + counter.getAndIncrement();
|
||||
// }
|
||||
// } );
|
||||
// executor.setKeepAliveTime( 1, TimeUnit.MINUTES );
|
||||
// executor.allowCoreThreadTimeOut( true );
|
||||
// return executor;
|
||||
}
|
||||
|
||||
}
|
|
@ -22,11 +22,5 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown">
|
||||
<constructor-arg ref="config"/>
|
||||
</bean>
|
||||
<bean id="config" class="org.apache.jackrabbit.core.config.RepositoryConfig" factory-method="create">
|
||||
<constructor-arg value="${basedir}/src/test/repository.xml"/>
|
||||
<constructor-arg value="${project.build.directory}/jcr"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -22,17 +22,19 @@ package org.apache.archiva.metadata.repository.jcr;
|
|||
import org.apache.archiva.metadata.model.MetadataFacetFactory;
|
||||
import org.apache.archiva.metadata.repository.AbstractMetadataRepositoryTest;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.BeforeClass;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.jcr.Repository;
|
||||
import javax.jcr.RepositoryException;
|
||||
import javax.jcr.Session;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
public class JcrMetadataRepositoryTest
|
||||
extends AbstractMetadataRepositoryTest
|
||||
|
@ -42,6 +44,21 @@ public class JcrMetadataRepositoryTest
|
|||
@Inject
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
private static Repository jcrRepository;
|
||||
|
||||
@BeforeClass
|
||||
public static void setupSpec() throws IOException, InvalidFileStoreVersionException
|
||||
{
|
||||
File directory = new File( "target/test-repositories" );
|
||||
if ( directory.exists() )
|
||||
{
|
||||
FileUtils.deleteDirectory( directory );
|
||||
}
|
||||
RepositoryFactory factory = new RepositoryFactory();
|
||||
factory.setRepositoryPath( directory.getPath() );
|
||||
jcrRepository = factory.createRepository();
|
||||
}
|
||||
|
||||
@Before
|
||||
@Override
|
||||
public void setUp()
|
||||
|
@ -49,17 +66,11 @@ public class JcrMetadataRepositoryTest
|
|||
{
|
||||
super.setUp();
|
||||
|
||||
File directory = new File( "target/test-repositories" );
|
||||
if ( directory.exists() )
|
||||
{
|
||||
FileUtils.deleteDirectory( directory );
|
||||
}
|
||||
|
||||
Map<String, MetadataFacetFactory> factories = createTestMetadataFacetFactories();
|
||||
|
||||
// TODO: probably don't need to use Spring for this
|
||||
Repository repository = applicationContext.getBean( Repository.class );
|
||||
jcrMetadataRepository = new JcrMetadataRepository( factories, repository );
|
||||
jcrMetadataRepository = new JcrMetadataRepository( factories, jcrRepository );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -70,6 +81,7 @@ public class JcrMetadataRepositoryTest
|
|||
|
||||
// removing content is faster than deleting and re-copying the files from target/jcr
|
||||
session.getRootNode().getNode( "repositories" ).remove();
|
||||
session.save();
|
||||
}
|
||||
catch ( RepositoryException e )
|
||||
{
|
||||
|
|
|
@ -24,32 +24,26 @@ import org.apache.archiva.metadata.model.MetadataFacetFactory;
|
|||
import org.apache.archiva.metadata.repository.AbstractMetadataRepositoryTest;
|
||||
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
|
||||
import org.apache.archiva.metadata.repository.jcr.JcrMetadataRepository;
|
||||
import org.apache.archiva.metadata.repository.jcr.RepositoryFactory;
|
||||
import org.apache.archiva.metadata.repository.stats.model.DefaultRepositoryStatistics;
|
||||
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
|
||||
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.jackrabbit.commons.JcrUtils;
|
||||
import org.apache.jackrabbit.core.TransientRepository;
|
||||
import org.apache.jackrabbit.core.config.RepositoryConfig;
|
||||
import org.apache.regexp.RE;
|
||||
import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.jcr.ImportUUIDBehavior;
|
||||
import javax.jcr.NamespaceRegistry;
|
||||
import javax.jcr.Node;
|
||||
import javax.jcr.Repository;
|
||||
import javax.jcr.RepositoryException;
|
||||
import javax.jcr.Session;
|
||||
import javax.jcr.SimpleCredentials;
|
||||
import javax.jcr.Workspace;
|
||||
import javax.jcr.nodetype.NodeTypeManager;
|
||||
import javax.jcr.nodetype.NodeTypeTemplate;
|
||||
import java.io.File;
|
||||
|
@ -59,12 +53,9 @@ import java.util.Date;
|
|||
import java.util.Map;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
|
||||
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
|
||||
public class JcrRepositoryStatisticsGatheringTest extends TestCase
|
||||
|
||||
{
|
||||
private static final int TOTAL_FILE_COUNT = 1000;
|
||||
|
||||
|
@ -80,13 +71,24 @@ public class JcrRepositoryStatisticsGatheringTest extends TestCase
|
|||
@Inject
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Inject
|
||||
@Named("repository")
|
||||
Repository jcrRepository;
|
||||
|
||||
Session session;
|
||||
|
||||
|
||||
private static Repository jcrRepository;
|
||||
|
||||
@BeforeClass
|
||||
public static void setupSpec() throws IOException, InvalidFileStoreVersionException
|
||||
{
|
||||
File directory = new File( "target/test-repositories" );
|
||||
if ( directory.exists() )
|
||||
{
|
||||
FileUtils.deleteDirectory( directory );
|
||||
}
|
||||
RepositoryFactory factory = new RepositoryFactory();
|
||||
factory.setRepositoryPath( directory.getPath() );
|
||||
factory.setStoreType( RepositoryFactory.StoreType.IN_MEMORY_TYPE );
|
||||
jcrRepository = factory.createRepository();
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
|
@ -94,18 +96,15 @@ public class JcrRepositoryStatisticsGatheringTest extends TestCase
|
|||
throws Exception
|
||||
{
|
||||
|
||||
File directory = new File( "target/test-repositories" );
|
||||
if ( directory.exists() )
|
||||
{
|
||||
FileUtils.deleteDirectory( directory );
|
||||
}
|
||||
|
||||
Map<String, MetadataFacetFactory> factories = AbstractMetadataRepositoryTest.createTestMetadataFacetFactories();
|
||||
|
||||
assertNotNull( jcrRepository );
|
||||
// TODO: probably don't need to use Spring for this
|
||||
JcrMetadataRepository jcrMetadataRepository = new JcrMetadataRepository( factories, jcrRepository );
|
||||
|
||||
|
||||
session = jcrMetadataRepository.getJcrSession();
|
||||
|
||||
try
|
||||
{
|
||||
session = jcrMetadataRepository.getJcrSession();
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
|
||||
<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.jackrabbit" level="info"/>
|
||||
<root level="info" includeLocation="true">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
</loggers>
|
||||
</configuration>
|
|
@ -112,7 +112,7 @@
|
|||
<executions>
|
||||
<execution>
|
||||
<id>test-repository</id>
|
||||
<phase>generate-test-resources</phase>
|
||||
<phase>process-test-classes</phase>
|
||||
<goals>
|
||||
<goal>unpack-dependencies</goal>
|
||||
</goals>
|
||||
|
|
|
@ -44,6 +44,10 @@
|
|||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.jcr</groupId>
|
||||
<artifactId>jcr</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-test-utils</artifactId>
|
||||
|
@ -65,6 +69,16 @@
|
|||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-jcr-commons</artifactId>
|
||||
<version>2.15.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>metadata-store-jcr</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
@ -79,6 +93,8 @@
|
|||
org.apache.archiva.metadata.repository.stats;version=${project.version}
|
||||
</Export-Package>
|
||||
<Import-Package>
|
||||
javax.jcr,
|
||||
javax.jcr.query,
|
||||
org.apache.archiva.metadata.model;version=${project.version},
|
||||
org.apache.archiva.metadata.repository;version=${project.version},
|
||||
org.apache.archiva.metadata.repository.storage.maven2;version=${project.version},
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
<executions>
|
||||
<execution>
|
||||
<id>test-repository</id>
|
||||
<phase>generate-test-resources</phase>
|
||||
<phase>process-test-classes</phase>
|
||||
<goals>
|
||||
<goal>unpack-dependencies</goal>
|
||||
</goals>
|
||||
|
|
108
pom.xml
108
pom.xml
|
@ -51,7 +51,7 @@
|
|||
<commons-codec.version>1.6</commons-codec.version>
|
||||
<commons-collections.version>3.2.1</commons-collections.version>
|
||||
<commons-fileupload.version>1.2.2</commons-fileupload.version>
|
||||
<commons-io.version>2.4</commons-io.version>
|
||||
<commons-io.version>2.5</commons-io.version>
|
||||
<commons-lang.version>2.6</commons-lang.version>
|
||||
|
||||
<maven3x.version>3.0.5</maven3x.version>
|
||||
|
@ -59,7 +59,8 @@
|
|||
<aether.version>1.13.1</aether.version>
|
||||
|
||||
<maven-model-converter.version>2.1</maven-model-converter.version>
|
||||
<maven.indexer.version>5.1.1</maven.indexer.version>
|
||||
<!-- TODO: Before Release 3.0 check, if stable version will be released -->
|
||||
<maven.indexer.version>6.0-SNAPSHOT</maven.indexer.version>
|
||||
<wagon.version>2.9</wagon.version>
|
||||
<redback.version>3.0.0-SNAPSHOT</redback.version>
|
||||
<redback.cache.version>2.2</redback.cache.version>
|
||||
|
@ -70,13 +71,15 @@
|
|||
<slf4j.version>1.7.25</slf4j.version>
|
||||
<log4j.version>2.8.2</log4j.version>
|
||||
|
||||
<spring.version>4.3.8.RELEASE</spring.version>
|
||||
<spring.version>4.3.10.RELEASE</spring.version>
|
||||
|
||||
<javax.jcr.version>2.0</javax.jcr.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>
|
||||
<lucene.version>3.6.2</lucene.version>
|
||||
<jackrabbit.version>2.14.1</jackrabbit.version>
|
||||
<lucene.version>4.10.4</lucene.version>
|
||||
|
||||
<jcr-oak.version>1.7.5</jcr-oak.version>
|
||||
<jackrabbit.version>2.15.4</jackrabbit.version>
|
||||
|
||||
<cxf.version>3.0.3</cxf.version>
|
||||
<derbyVersion>10.13.1.1</derbyVersion>
|
||||
|
@ -85,7 +88,7 @@
|
|||
<javaxMailVersion>1.4</javaxMailVersion>
|
||||
<!--jettyVersion>9.4.5.v20170502</jettyVersion-->
|
||||
<jettyVersion>9.4.7-SNAPSHOT</jettyVersion>
|
||||
<guava.version>22.0</guava.version>
|
||||
<guava.version>15.0</guava.version>
|
||||
<openjpaVersion>2.4.1</openjpaVersion>
|
||||
|
||||
<!-- restore when we will be able to use a derby in memory database -->
|
||||
|
@ -126,17 +129,6 @@
|
|||
<version>1.7.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-webdav</artifactId>
|
||||
<version>${jackrabbit.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
|
@ -300,11 +292,57 @@
|
|||
<artifactId>archiva-indexer</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-jcr</artifactId>
|
||||
<version>${jcr-oak.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-segment-tar</artifactId>
|
||||
<version>${jcr-oak.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-lucene</artifactId>
|
||||
<version>${jcr-oak.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-misc</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-facet</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-webdav</artifactId>
|
||||
<version>${jackrabbit.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.indexer</groupId>
|
||||
<artifactId>indexer-reader</artifactId>
|
||||
<version>${maven.indexer.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.indexer</groupId>
|
||||
<artifactId>indexer-core</artifactId>
|
||||
<version>${maven.indexer.version}</version>
|
||||
<classifier>shaded-lucene</classifier>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
|
@ -333,6 +371,29 @@
|
|||
<groupId>com.google.code.atinject</groupId>
|
||||
<artifactId>atinject</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.sonatype.sisu</groupId>
|
||||
<artifactId>sisu-guava</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.sonatype.sisu</groupId>
|
||||
<artifactId>sisu-guice</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.archetype</groupId>
|
||||
<artifactId>archetype-common</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.sonatype.sisu</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
@ -1322,16 +1383,7 @@
|
|||
<artifactId>jcr</artifactId>
|
||||
<version>${javax.jcr.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-jcr-commons</artifactId>
|
||||
<version>${jackrabbit.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-core</artifactId>
|
||||
<version>${jackrabbit.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Transitive versions to manage -->
|
||||
<dependency>
|
||||
|
@ -1628,7 +1680,7 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>@{jacocoproperty}</argLine>
|
||||
<argLine></argLine>
|
||||
<redirectTestOutputToFile>${surefire.redirectTestOutputToFile}</redirectTestOutputToFile>
|
||||
<runOrder>alphabetical</runOrder>
|
||||
<systemPropertyVariables>
|
||||
|
|
Loading…
Reference in New Issue