/** * @param id * Repository ID. This ID has to match the ID in the repository index, due to a design bug in Maven. * @param indexDirectory * Directory that contains exploded index zip file. * @param repository * URL of the Maven repository. Used to resolve artifacts. */ public void addRemoteRepository(String id, File indexDirectory, URL repository) throws IOException, UnsupportedExistingLuceneIndexException { indexer.addIndexingContext(id, id,null, indexDirectory,null,null, NexusIndexer.DEFAULT_INDEX); remoteRepositories.add( arf.createArtifactRepository(id, repository.toExternalForm(), new DefaultRepositoryLayout(), POLICY, POLICY)); }
public Object run() throws Exception { IndexingContext indexingContext = indexer.addIndexingContext( // repoId, // context id repoId, // repository id repoDir, // repository folder new File(indexDir, repoId), // index folder null, // repositoryUrl null, // index update url NB_INDEX); if (indexingContext == null) { LOGGER.warning("Indexing context chould not be created :"+repoId);//NOI18N return null; } indexer.scan(indexingContext, new RepositoryIndexerListener(indexer, indexingContext, true), true); indexer.removeIndexingContext(indexingContext, false); return null; } });
context = indexer.addIndexingContext( //
private void loadIndexingContext(final RepositoryInfo... repoids) throws IOException, UnsupportedExistingLuceneIndexException { assert MUTEX.isWriteAccess(); for (RepositoryInfo info : repoids) { LOGGER.finer("Loading Context :" + info.getId());//NOI18N if (info.isLocal() || info.isRemoteDownloadable()) { indexer.addIndexingContext( // info.getId(), // context id info.getId(), // repository id info.isLocal() ? new File(info.getRepositoryPath()) : null, // repository folder new File(getDefaultIndexLocation(), info.getId()), // index folder info.isRemoteDownloadable() ? info.getRepositoryUrl() : null, // repositoryUrl info.isRemoteDownloadable() ? info.getIndexUpdateUrl() : null, // index update url NB_INDEX); } } }