本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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();
}
示例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;
}
}
示例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();
}
示例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);
// }
}
示例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 );
}
}
示例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);
}
示例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