本文整理汇总了Java中org.codehaus.plexus.ContainerConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java ContainerConfiguration类的具体用法?Java ContainerConfiguration怎么用?Java ContainerConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContainerConfiguration类属于org.codehaus.plexus包,在下文中一共展示了ContainerConfiguration类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createProjectLikeEmbedder
import org.codehaus.plexus.ContainerConfiguration; //导入依赖的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: createNow
import org.codehaus.plexus.ContainerConfiguration; //导入依赖的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
示例3: initIndexer
import org.codehaus.plexus.ContainerConfiguration; //导入依赖的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
示例4: setupPlexusContainer
import org.codehaus.plexus.ContainerConfiguration; //导入依赖的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
示例5: createOnlineEmbedder
import org.codehaus.plexus.ContainerConfiguration; //导入依赖的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
示例6: customizeContainerConfiguration
import org.codehaus.plexus.ContainerConfiguration; //导入依赖的package包/类
/**
* We need to customize the standard Plexus container with the plugin discovery listener which
* is what looks for the META-INF/maven/plugin.xml resources that enter the system when a Maven
* plugin is loaded.
*
* We also need to customize the Plexus container with a standard plugin discovery listener
* which is the MavenPluginCollector. When a Maven plugin is discovered the MavenPluginCollector
* collects the plugin descriptors which are found.
*/
protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
{
// containerConfiguration.addComponentDiscoverer( PluginManager.class );
// containerConfiguration.addComponentDiscoveryListener( PluginManager.class );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:15,代码来源:AbstractCoreMavenComponentTestCase.java
注:本文中的org.codehaus.plexus.ContainerConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论