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


Java DefaultContainerConfiguration类代码示例

本文整理汇总了Java中org.codehaus.plexus.DefaultContainerConfiguration的典型用法代码示例。如果您正苦于以下问题:Java DefaultContainerConfiguration类的具体用法?Java DefaultContainerConfiguration怎么用?Java DefaultContainerConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DefaultContainerConfiguration类属于org.codehaus.plexus包,在下文中一共展示了DefaultContainerConfiguration类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createProjectLikeEmbedder

import org.codehaus.plexus.DefaultContainerConfiguration; //导入依赖的package包/类
public static @NonNull MavenEmbedder createProjectLikeEmbedder() throws PlexusContainerException {
        final String mavenCoreRealmId = "plexus.core";
        ContainerConfiguration dpcreq = new DefaultContainerConfiguration()
            .setClassWorld( new ClassWorld(mavenCoreRealmId, EmbedderFactory.class.getClassLoader()) )
            .setClassPathScanning( PlexusConstants.SCANNING_INDEX )
            .setName("maven");
        
        DefaultPlexusContainer pc = new DefaultPlexusContainer(dpcreq, new ExtensionModule());
        pc.setLoggerManager(new NbLoggerManager());

        Properties userprops = new Properties();
        userprops.putAll(getCustomGlobalUserProperties());
        EmbedderConfiguration configuration = new EmbedderConfiguration(pc, cloneStaticProps(), userprops, true, getSettingsXml());
        
        try {
            return new MavenEmbedder(configuration);
            //MEVENIDE-634 make all instances non-interactive
//            WagonManager wagonManager = (WagonManager) embedder.getPlexusContainer().lookup(WagonManager.ROLE);
//            wagonManager.setInteractive(false);
        } catch (ComponentLookupException ex) {
            throw new PlexusContainerException(ex.toString(), ex);
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:EmbedderFactory.java

示例2: createTest

import org.codehaus.plexus.DefaultContainerConfiguration; //导入依赖的package包/类
@Override
protected Object createTest()
    throws Exception
{
    final TestClass testClass = getTestClass();

    final DefaultContainerConfiguration config = new DefaultContainerConfiguration();

    config.setAutoWiring( true );
    config.setClassPathScanning( PlexusConstants.SCANNING_ON );
    config.setComponentVisibility( PlexusConstants.GLOBAL_VISIBILITY );
    config.setName( testClass.getName() );

    final DefaultPlexusContainer container = new DefaultPlexusContainer( config );
    final ClassSpace cs = new URLClassSpace( Thread.currentThread()
                                                   .getContextClassLoader() );

    container.addPlexusInjector( Arrays.<PlexusBeanModule> asList( new PlexusAnnotatedBeanModule(
                                                                                                  cs,
                                                                                                  Collections.emptyMap() ) ) );

    return container.lookup( testClass.getJavaClass() );
}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:24,代码来源:PlexusTestRunner.java

示例3: aetherContainer

import org.codehaus.plexus.DefaultContainerConfiguration; //导入依赖的package包/类
@Provides @Aether @Singleton
public PlexusContainer aetherContainer() {
    try {
        return new DefaultPlexusContainer(
            new DefaultContainerConfiguration(),
            new AbstractModule() {
                @Override
                protected void configure() {
                    bind(VersionResolver.class).to(VersionResolverImpl.class);
                }

                // DefaultSettingSettingsDecrypter looks for the "maven" name
                @Provides @Singleton @Named("maven")
                public SecDispatcher getDispatcher(DefaultSecDispatcher base) {
                    base.setConfigurationFile("~/.m2/settings-security.xml");
                    return base;
                }
            }
        );
    } catch (PlexusContainerException e) {
        throw new RuntimeException("Unable to load RepositorySystem component by Plexus, cannot establish Aether dependency resolver.", e);
    }
}
 
开发者ID:cloudbees,项目名称:bees-maven-components,代码行数:24,代码来源:RepositorySystemModule.java

示例4: createNow

import org.codehaus.plexus.DefaultContainerConfiguration; //导入依赖的package包/类
private Set<MavenProject> createNow(Settings settings, File pomFile) throws PlexusContainerException, PlexusConfigurationException, ComponentLookupException, MavenExecutionRequestPopulationException, ProjectBuildingException {
    ContainerConfiguration containerConfiguration = new DefaultContainerConfiguration()
            .setClassWorld(new ClassWorld("plexus.core", ClassWorld.class.getClassLoader()))
            .setName("mavenCore");

    DefaultPlexusContainer container = new DefaultPlexusContainer(containerConfiguration);
    ProjectBuilder builder = container.lookup(ProjectBuilder.class);
    MavenExecutionRequest executionRequest = new DefaultMavenExecutionRequest();
    final Properties properties = new Properties();
    properties.putAll(SystemProperties.getInstance().asMap());
    executionRequest.setSystemProperties(properties);
    MavenExecutionRequestPopulator populator = container.lookup(MavenExecutionRequestPopulator.class);
    populator.populateFromSettings(executionRequest, settings);
    populator.populateDefaults(executionRequest);
    ProjectBuildingRequest buildingRequest = executionRequest.getProjectBuildingRequest();
    buildingRequest.setProcessPlugins(false);
    MavenProject mavenProject = builder.build(pomFile, buildingRequest).getProject();
    Set<MavenProject> reactorProjects = new LinkedHashSet<MavenProject>();

    //TODO adding the parent project first because the converter needs it this way ATM. This is oversimplified.
    //the converter should not depend on the order of reactor projects.
    //we should add coverage for nested multi-project builds with multiple parents.
    reactorProjects.add(mavenProject);
    List<ProjectBuildingResult> allProjects = builder.build(ImmutableList.of(pomFile), true, buildingRequest);
    CollectionUtils.collect(allProjects, reactorProjects, new Transformer<MavenProject, ProjectBuildingResult>() {
        public MavenProject transform(ProjectBuildingResult original) {
            return original.getProject();
        }
    });

    MavenExecutionResult result = new DefaultMavenExecutionResult();
    result.setProject(mavenProject);
    RepositorySystemSession repoSession = new DefaultRepositorySystemSession();
    MavenSession session = new MavenSession(container, repoSession, executionRequest, result);
    session.setCurrentProject(mavenProject);

    return reactorProjects;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:39,代码来源:MavenProjectsCreator.java

示例5: initIndexer

import org.codehaus.plexus.DefaultContainerConfiguration; //导入依赖的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

示例6: setupPlexusContainer

import org.codehaus.plexus.DefaultContainerConfiguration; //导入依赖的package包/类
/**
 * Test if XMvn WorkspaceReader component can be loaded by Sisu Plexus shim.
 * 
 * @throws Exception
 */
@Before
public void setupPlexusContainer()
    throws Exception
{
    ContainerConfiguration config = new DefaultContainerConfiguration();
    config.setAutoWiring( true );
    config.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
    container = new DefaultPlexusContainer( config );
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:15,代码来源:AbstractTest.java

示例7: createOnlineEmbedder

import org.codehaus.plexus.DefaultContainerConfiguration; //导入依赖的package包/类
@NonNull static MavenEmbedder createOnlineEmbedder() throws PlexusContainerException {
        final String mavenCoreRealmId = "plexus.core";
        ContainerConfiguration dpcreq = new DefaultContainerConfiguration()
            .setClassWorld( new ClassWorld(mavenCoreRealmId, EmbedderFactory.class.getClassLoader()) )
            .setClassPathScanning( PlexusConstants.SCANNING_INDEX )
            .setName("maven");

        DefaultPlexusContainer pc = new DefaultPlexusContainer(dpcreq);
        pc.setLoggerManager(new NbLoggerManager());

        Properties userprops = new Properties();
        userprops.putAll(getCustomGlobalUserProperties());
        EmbedderConfiguration req = new EmbedderConfiguration(pc, cloneStaticProps(), userprops, false, getSettingsXml());

//        //TODO remove explicit activation
//        req.addActiveProfile("netbeans-public").addActiveProfile("netbeans-private"); //NOI18N


//        req.setConfigurationCustomizer(new ContainerCustomizer() {
//
//            public void customize(PlexusContainer plexusContainer) {
//                    //MEVENIDE-634
//                    ComponentDescriptor desc = plexusContainer.getComponentDescriptor(KnownHostsProvider.ROLE, "file"); //NOI18N
//                    desc.getConfiguration().getChild("hostKeyChecking").setValue("no"); //NOI18N
//
//                    //MEVENIDE-634
//                    desc = plexusContainer.getComponentDescriptor(KnownHostsProvider.ROLE, "null"); //NOI18N
//                    desc.getConfiguration().getChild("hostKeyChecking").setValue("no"); //NOI18N
//            }
//        });

        try {
            return new MavenEmbedder(req);
            //MEVENIDE-634 make all instances non-interactive
//            WagonManager wagonManager = (WagonManager) embedder.getPlexusContainer().lookup(WagonManager.ROLE);
//            wagonManager.setInteractive(false);
        } catch (ComponentLookupException ex) {
            throw new PlexusContainerException(ex.toString(), ex);
        }
//            try {
//                //MEVENIDE-634 make all instances non-interactive
//                WagonManager wagonManager = (WagonManager) embedder.getPlexusContainer().lookup(WagonManager.ROLE);
//                wagonManager.setInteractive( false );
//                wagonManager.setDownloadMonitor(new ProgressTransferListener());
//            } catch (ComponentLookupException ex) {
//                ErrorManager.getDefault().notify(ex);
//            }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:EmbedderFactory.java

示例8: initialize

import org.codehaus.plexus.DefaultContainerConfiguration; //导入依赖的package包/类
@PostConstruct
public void initialize()
    throws PlexusSisuBridgeException
{
    DefaultContainerConfiguration conf = new DefaultContainerConfiguration();

    conf.setAutoWiring( containerAutoWiring );
    conf.setClassPathScanning( containerClassPathScanning );
    conf.setComponentVisibility( containerComponentVisibility );

    conf.setContainerConfigurationURL( overridingComponentsXml );

    ClassWorld classWorld = new ClassWorld();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    containerRealm = new ClassRealm( classWorld, "maven", tccl );

    // olamy hackhish but plexus-sisu need a URLClassLoader with URL filled

    if ( tccl instanceof URLClassLoader )
    {
        URL[] urls = ( (URLClassLoader) tccl ).getURLs();
        for ( URL url : urls )
        {
            containerRealm.addURL( url );
        }
    }

    conf.setRealm( containerRealm );

    //conf.setClassWorld( classWorld );

    ClassLoader ori = Thread.currentThread().getContextClassLoader();

    try
    {
        Thread.currentThread().setContextClassLoader( containerRealm );
        plexusContainer = new DefaultPlexusContainer( conf );
    }
    catch ( PlexusContainerException e )
    {
        throw new PlexusSisuBridgeException( e.getMessage(), e );
    }
    finally
    {
        Thread.currentThread().setContextClassLoader( ori );
    }
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:50,代码来源:PlexusSisuBridge.java


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