本文整理汇总了Java中org.apache.maven.index.Scanner类的典型用法代码示例。如果您正苦于以下问题:Java Scanner类的具体用法?Java Scanner怎么用?Java Scanner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Scanner类属于org.apache.maven.index包,在下文中一共展示了Scanner类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initIndexer
import org.apache.maven.index.Scanner; //导入依赖的package包/类
private void initIndexer () {
if (!inited) {
try {
ContainerConfiguration config = new DefaultContainerConfiguration();
//#154755 - start
ClassWorld world = new ClassWorld();
ClassRealm embedderRealm = world.newRealm("maven.embedder", MavenEmbedder.class.getClassLoader()); //NOI18N
ClassLoader indexerLoader = NexusRepositoryIndexerImpl.class.getClassLoader();
ClassRealm indexerRealm = world.newRealm("maven.indexer", indexerLoader); //NOI18N
ClassRealm plexusRealm = world.newRealm("plexus.core", indexerLoader); //NOI18N
//need to import META-INF/plexus stuff, otherwise the items in META-INF will not be loaded,
// and the Dependency Injection won't work.
plexusRealm.importFrom(embedderRealm.getId(), "META-INF/plexus"); //NOI18N
plexusRealm.importFrom(embedderRealm.getId(), "META-INF/maven"); //NOI18N
plexusRealm.importFrom(indexerRealm.getId(), "META-INF/plexus"); //NOI18N
plexusRealm.importFrom(indexerRealm.getId(), "META-INF/maven"); //NOI18N
config.setClassWorld(world);
config.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
//#154755 - end
embedder = new DefaultPlexusContainer(config);
ComponentDescriptor<ArtifactContextProducer> desc = new ComponentDescriptor<ArtifactContextProducer>();
desc.setRoleClass(ArtifactContextProducer.class);
desc.setImplementationClass(CustomArtifactContextProducer.class);
ComponentRequirement req = new ComponentRequirement(); // XXX why is this not automatic?
req.setFieldName("mapper");
req.setRole(ArtifactPackagingMapper.class.getName());
desc.addRequirement(req);
embedder.addComponentDescriptor(desc);
indexer = embedder.lookup(Indexer.class);
scanner = embedder.lookup(org.apache.maven.index.Scanner.class);
searcher = embedder.lookup(SearchEngine.class);
remoteIndexUpdater = embedder.lookup(IndexUpdater.class);
contextProducer = embedder.lookup(ArtifactContextProducer.class);
inited = true;
} catch (Exception x) {
Exceptions.printStackTrace(x);
}
}
}