String repositoryName = cli.hasOption( NAME ) ? cli.getOptionValue( NAME ) : indexDirectory.getName();
File repository = new File( cli.getOptionValue( REPO ) );
NexusIndexer indexer = (NexusIndexer) plexus.lookup( NexusIndexer.class );
IndexPacker packer = (IndexPacker) plexus.lookup( IndexPacker.class );
IndexingContext indexingContext = indexer.addIndexingContext( //
repositoryName, // context id
repositoryName, // repository id
repository, // repository folder
indexDirectory, // index folder
null, // repositoryUrl
null, // index update url
indexers,
false);
boolean createZip = cli.hasOption( ZIP );
boolean debug = cli.hasOption( DEBUG );
boolean update = cli.hasOption( UPDATE );
ArtifactScanningListener listener = new IndexerListener( indexingContext, packer, createZip, debug, update );
indexer.scan( indexingContext, listener, update );
}