当前位置: 首页>>代码示例>>Java>>正文


Java Scanner类代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:NexusRepositoryIndexerImpl.java


注:本文中的org.apache.maven.index.Scanner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。