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


Java DefaultPlexusContainer类代码示例

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


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

示例1: createProjectLikeEmbedder

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

import org.codehaus.plexus.DefaultPlexusContainer; //导入依赖的package包/类
private ManipulationSession createUpdateSession() throws Exception
{
    ManipulationSession session = new ManipulationSession();

    session.setState( new DependencyState( p ) );
    session.setState( new VersioningState( p ) );
    session.setState( new CommonState( p ) );

    final MavenExecutionRequest req =
                    new DefaultMavenExecutionRequest().setUserProperties( p ).setRemoteRepositories( Collections.<ArtifactRepository>emptyList() );

    final PlexusContainer container = new DefaultPlexusContainer();
    final MavenSession mavenSession = new MavenSession( container, null, req, new DefaultMavenExecutionResult() );

    session.setMavenSession( mavenSession );

    return session;
}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:19,代码来源:PropertiesUtilsTest.java

示例4: aetherContainer

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

示例5: createNow

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

示例6: initIndexer

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

示例7: init

import org.codehaus.plexus.DefaultPlexusContainer; //导入依赖的package包/类
@Override
    public void init( Context context )
        throws Exception
    {
        super.init( context );
        LOGGER.info( "{} Version {} started.", DPRE, DeploymentRecorderExtensionVersion.getVersion() );

        // Is this always in the context? Based on Maven Core yes.
        String workingDirectory = (String) context.getData().get( "workingDirectory" );
        LOGGER.debug( "{}: workingDirectory: {}", DPRE, workingDirectory );

        Properties systemProperties = (Properties) context.getData().get( "systemProperties" );
        // This is only available from 3.3.+
        String multiModuleProjectDirectory = systemProperties.getProperty( "maven.multiModuleProjectDirectory" );
        rootDirectory = new File( multiModuleProjectDirectory );
        LOGGER.debug( "{}: multiModuleProjectDirectory: {}", DPRE, multiModuleProjectDirectory );

        DefaultPlexusContainer contextContain = (DefaultPlexusContainer) context.getData().get( "context" );
        LOGGER.info( "contextContain: {}", contextContain );

//        LOGGER.info( " fileName: {}", fileName );
//        LOGGER.info( " anOtherFile: {}", anOtherFile );
//        LOGGER.info( " moreParameters: {}", moreParameters );
//        LOGGER.info( " injected: {}", injected );
//        LOGGER.info( " injectsisu: {}", injectsisu );
        

    }
 
开发者ID:khmarbaise,项目名称:deployment-recorder-extension,代码行数:29,代码来源:DeploymentRecorderExtension.java

示例8: setupPlexusContainer

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

示例9: MavenEmbedder

import org.codehaus.plexus.DefaultPlexusContainer; //导入依赖的package包/类
private MavenEmbedder(@NotNull DefaultPlexusContainer container,
                      @NotNull Settings settings,
                      @NotNull Logger logger,
                      @NotNull MavenEmbedderSettings embedderSettings) {
  myContainer = container;
  mySettings = settings;
  myLogger = logger;
  myEmbedderSettings = embedderSettings;
  myLocalRepository = createLocalRepository(embedderSettings);

  loadSettings();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:MavenEmbedder.java

示例10: create

import org.codehaus.plexus.DefaultPlexusContainer; //导入依赖的package包/类
@NotNull
public static MavenEmbedder create(@NotNull final MavenEmbedderSettings embedderSettings) {
  @NotNull final Logger logger = getLogger(embedderSettings);

  DefaultPlexusContainer container = new DefaultPlexusContainer();
  container.setClassWorld(new ClassWorld("plexus.core", embedderSettings.getClass().getClassLoader()));
  container.setLoggerManager(new BaseLoggerManager() {
    @Override
    protected Logger createLogger(final String s) {
      return logger;
    }
  });

  try {
    container.initialize();
    container.start();
  }
  catch (PlexusContainerException e) {
    MavenEmbedderLog.LOG.error(e);
    throw new RuntimeException(e);
  }

  final PlexusComponentConfigurator configurator = embedderSettings.getConfigurator();
  if (configurator != null) {
    configurator.configureComponents(container);
  }

  File mavenHome = embedderSettings.getMavenHome();
  if (mavenHome != null) {
    System.setProperty(PROP_MAVEN_HOME, mavenHome.getPath());
  }

  Settings nativeSettings = buildSettings(container, embedderSettings);

  return new MavenEmbedder(container, nativeSettings, logger, embedderSettings);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:MavenEmbedder.java

示例11: customizeContainer

import org.codehaus.plexus.DefaultPlexusContainer; //导入依赖的package包/类
@Override
protected void customizeContainer(PlexusContainer container)
{
  ((DefaultPlexusContainer)container).setLoggerManager(
      new BaseLoggerManager()
      {
        @Override
        protected org.codehaus.plexus.logging.Logger createLogger(String s)
        {
          return new Slf4jLogger(LOG);
        }
      }
  );
}
 
开发者ID:apache,项目名称:apex-core,代码行数:15,代码来源:StramTestSupport.java

示例12: setupSession

import org.codehaus.plexus.DefaultPlexusContainer; //导入依赖的package包/类
private VersioningState setupSession( final Properties properties, final Map<ProjectRef, String[]> versionMap )
    throws Exception
{
    final ArtifactRepository ar =
        new MavenArtifactRepository( "test", "http://repo.maven.apache.org/maven2", new DefaultRepositoryLayout(),
                                     new ArtifactRepositoryPolicy(), new ArtifactRepositoryPolicy() );

    final MavenExecutionRequest req =
        new DefaultMavenExecutionRequest().setUserProperties( properties )
                                          .setRemoteRepositories( Arrays.asList( ar ) );

    final PlexusContainer container = new DefaultPlexusContainer();

    final MavenSession mavenSession = new MavenSession( container, null, req, new DefaultMavenExecutionResult() );

    session = new ManipulationSession();
    session.setMavenSession( mavenSession );

    final VersioningState state = new VersioningState( properties );
    session.setState( state );

    final Map<String, byte[]> dataMap = new HashMap<>();
    if ( versionMap != null && !versionMap.isEmpty() )
    {
        for ( final Map.Entry<ProjectRef, String[]> entry : versionMap.entrySet() )
        {
            final String path = toMetadataPath( entry.getKey() );
            final byte[] data = setupMetadataVersions( entry.getValue() );
            dataMap.put( path, data );
        }
    }

    final Location mdLoc = MavenLocationExpander.EXPANSION_TARGET;
    final Transport mdTrans = new StubTransport( dataMap );

    modder =
        new TestVersionCalculator( new ManipulationSession(), mdLoc, mdTrans, temp.newFolder( "galley-cache" ) );

    return state;
}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:41,代码来源:VersioningCalculatorTest.java

示例13: setMavenSession

import org.codehaus.plexus.DefaultPlexusContainer; //导入依赖的package包/类
private void setMavenSession()
    throws Exception
{
    final MavenExecutionRequest req =
        new DefaultMavenExecutionRequest().setUserProperties( userCliProperties )
                                          .setRemoteRepositories( Collections.<ArtifactRepository> emptyList() );

    final PlexusContainer container = new DefaultPlexusContainer();
    final MavenSession mavenSession = new MavenSession( container, null, req, new DefaultMavenExecutionResult() );

    session.setMavenSession( mavenSession );

}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:14,代码来源:DistributionEnforcingManipulatorTest.java

示例14: initContainer

import org.codehaus.plexus.DefaultPlexusContainer; //导入依赖的package包/类
private static PlexusContainer initContainer()
{
	try
	{
		return new DefaultPlexusContainer();
	}
	catch(PlexusContainerException e)
	{
		log.error("Error initializing Maven", e);
		return null;
	}
}
 
开发者ID:bnavetta,项目名称:tycho-gen,代码行数:13,代码来源:Maven.java

示例15: testMinimalSolutionConfiguration

import org.codehaus.plexus.DefaultPlexusContainer; //导入依赖的package包/类
@Test
public final void testMinimalSolutionConfiguration() throws Exception 
{
    ( (DefaultPlexusContainer) getContainer() ).getLoggerManager().setThreshold( Logger.LEVEL_DEBUG );
    CppCheckMojo cppCheckMojo = ( CppCheckMojo ) lookupConfiguredMojo( CppCheckMojo.MOJO_NAME, 
            "/unit/cppcheck/sln-single-platform-single-config-pom.xml" );

    cppCheckMojo.execute();
}
 
开发者ID:andi12,项目名称:msbuild-maven-plugin,代码行数:10,代码来源:CppCheckMojoTest.java


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