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


Java PlexusContainerException类代码示例

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


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

示例1: createProjectLikeEmbedder

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

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

示例3: createNow

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

示例4: getProjectEmbedder

import org.codehaus.plexus.PlexusContainerException; //导入依赖的package包/类
public static @NonNull MavenEmbedder getProjectEmbedder() {
    synchronized (PROJECT_LOCK) {
        if (project == null) {
            try {
                project = createProjectLikeEmbedder();
            } catch (PlexusContainerException ex) {
                rethrowThreadDeath(ex);
                throw new IllegalStateException(ex);
            }
            projectLoaded.set(true);
        }
        return project;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:EmbedderFactory.java

示例5: getOnlineEmbedder

import org.codehaus.plexus.PlexusContainerException; //导入依赖的package包/类
public static @NonNull MavenEmbedder getOnlineEmbedder() {
    synchronized (ONLINE_LOCK) {
        if (online == null) {
            try {
                online = createOnlineEmbedder();
            } catch (PlexusContainerException ex) {
                rethrowThreadDeath(ex);
                throw new IllegalStateException(ex);
            }
        }
        return online;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:EmbedderFactory.java

示例6: create

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

示例7: addProtocolProvider

import org.codehaus.plexus.PlexusContainerException; //导入依赖的package包/类
private void addProtocolProvider(CustomDeployTask deployTask) {
    PlexusContainer plexusContainer = deployTask.getContainer();
    for (File wagonProviderJar : getJars()) {
        try {
            plexusContainer.addJarResource(wagonProviderJar);
        } catch (PlexusContainerException e) {
            throw new RuntimeException(e);
        }
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:11,代码来源:BaseMavenDeployer.java

示例8: newRepositorySystem

import org.codehaus.plexus.PlexusContainerException; //导入依赖的package包/类
protected RepositorySystem newRepositorySystem() throws PlexusContainerException, ComponentLookupException {
    DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
    locator.addService(RepositorySystem.class, DefaultRepositorySystem.class);
    locator.addService(RepositoryConnectorFactory.class,
            BasicRepositoryConnectorFactory.class);
    locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
    locator.addService(TransporterFactory.class, FileTransporterFactory.class);
    return locator.getService(RepositorySystem.class);
}
 
开发者ID:igor-suhorukov,项目名称:mvn-classloader,代码行数:10,代码来源:ClassLoaderBuilder.java

示例9: resolveArtifact

import org.codehaus.plexus.PlexusContainerException; //导入依赖的package包/类
public URL resolveArtifact(String gav) throws PlexusContainerException, ComponentLookupException,
        ArtifactResolutionException, MalformedURLException {

    RepositorySystem repositorySystem = newRepositorySystem();
    RepositorySystemSession session = newSession(repositorySystem);
    ArtifactRequest artifactRequest = new ArtifactRequest();
    for (RemoteRepository repository : repositories) {
        artifactRequest.addRepository(RepositoryUtils.applySessionSettingsToRepository(session, repository));
    }
    artifactRequest.setArtifact(new DefaultArtifact(gav));
    ArtifactResult artifactResult = repositorySystem.resolveArtifact(session, artifactRequest);
    return artifactResult.getArtifact().getFile().toURI().toURL();
}
 
开发者ID:igor-suhorukov,项目名称:mvn-classloader,代码行数:14,代码来源:ClassLoaderBuilder.java

示例10: initContainer

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

示例11: PluginManagerException

import org.codehaus.plexus.PlexusContainerException; //导入依赖的package包/类
public PluginManagerException( MojoDescriptor mojoDescriptor, String message, MavenProject project,
                               PlexusContainerException cause )
{
    super( message, cause );

    this.project = project;

    PluginDescriptor pd = mojoDescriptor.getPluginDescriptor();
    pluginGroupId = pd.getGroupId();
    pluginArtifactId = pd.getArtifactId();
    pluginVersion = pd.getVersion();

    goal = mojoDescriptor.getGoal();
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:15,代码来源:PluginManagerException.java

示例12: createOnlineEmbedder

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

示例13: initialize

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

示例14: collectDependenciesIntoArtifacts

import org.codehaus.plexus.PlexusContainerException; //导入依赖的package包/类
private List<Artifact> collectDependenciesIntoArtifacts(CollectRequest collectRequest)
  throws PlexusContainerException, ComponentLookupException, DependencyCollectionException, ArtifactResolutionException, DependencyResolutionException {

  RepositorySystem repositorySystem = newRepositorySystem();
  RepositorySystemSession session = newSession(repositorySystem);
  DependencyNode node = repositorySystem.collectDependencies(session, collectRequest).getRoot();

  DependencyFilter filter = new ScopeDependencyFilter();

  DependencyRequest request = new DependencyRequest(node, filter);

  repositorySystem.resolveDependencies(session, request);

  // PathRecordingDependencyVisitor will give every path, which may help in building a hierarchical class loader
  PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
  node.accept(nlg);

  return nlg.getArtifacts(false);
}
 
开发者ID:zulily,项目名称:dropship,代码行数:20,代码来源:MavenArtifactResolution.java

示例15: removeComponentRealm

import org.codehaus.plexus.PlexusContainerException; //导入依赖的package包/类
@Override
public void removeComponentRealm(ClassRealm componentRealm) throws PlexusContainerException {
  plexusContainer.removeComponentRealm(componentRealm);
}
 
开发者ID:ImmobilienScout24,项目名称:illegal-transitive-dependency-check,代码行数:5,代码来源:EnforcerRuleHelperWrapper.java


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