use of org.codehaus.plexus.DefaultPlexusContainer in project pom-manipulation-ext by release-engineering.
the class DistributionEnforcingManipulatorTest method setMavenSession.
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);
}
use of org.codehaus.plexus.DefaultPlexusContainer in project pom-manipulation-ext by release-engineering.
the class PropertiesUtilsTest method createUpdateSession.
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;
}
use of org.codehaus.plexus.DefaultPlexusContainer in project plugin-compat-tester by jenkinsci.
the class SCMManagerFactory method start.
public void start() throws PlexusContainerException {
if (plexus == null) {
this.plexus = new DefaultPlexusContainer();
try {
// These will only be useful for Hudson v1.395 and under
// ... Since the use of sisu-plexus-inject will initialize
// everything in the constructor
PlexusContainer.class.getDeclaredMethod("initialize").invoke(this.plexus);
PlexusContainer.class.getDeclaredMethod("start").invoke(this.plexus);
} catch (Throwable e) {
/* Don't do anything here ... initialize/start methods should be called prior to v1.395 ! */
}
}
}
use of org.codehaus.plexus.DefaultPlexusContainer in project spring-cloud-function by spring-cloud.
the class DependencyResolutionModule method initialize.
private void initialize() {
if (this.container == null) {
synchronized (lock) {
if (this.container == null) {
ClassWorld classWorld = new ClassWorld("plexus.core", Thread.currentThread().getContextClassLoader());
ContainerConfiguration config = new DefaultContainerConfiguration().setClassWorld(classWorld).setRealm(classWorld.getClassRealm("plexus.core")).setClassPathScanning(PlexusConstants.SCANNING_INDEX).setAutoWiring(true).setName("maven");
PlexusContainer container;
try {
container = new DefaultPlexusContainer(config, new AetherModule(), new DependencyResolutionModule());
localRepositoryManagerFactory = container.lookup(LocalRepositoryManagerFactory.class);
container.addComponent(new ClassRealmManager((MutablePlexusContainer) container, new DefaultBeanLocator()), ClassRealmManager.class.getName());
projectBuilder = container.lookup(ProjectBuilder.class);
repositorySystem = container.lookup(RepositorySystem.class);
} catch (Exception e) {
throw new IllegalStateException("Cannot create container", e);
}
this.container = container;
this.settings = new MavenSettingsReader().readSettings();
}
}
}
}
use of org.codehaus.plexus.DefaultPlexusContainer in project sts4 by spring-projects.
the class MavenBridge method newPlexusContainer.
private static DefaultPlexusContainer newPlexusContainer() throws PlexusContainerException {
final ClassWorld classWorld = new ClassWorld(MAVEN_CORE_REALM_ID, ClassWorld.class.getClassLoader());
final ClassRealm realm;
try {
realm = classWorld.getRealm(MAVEN_CORE_REALM_ID);
} catch (NoSuchRealmException e) {
throw new PlexusContainerException("Could not lookup required class realm", e);
}
final ContainerConfiguration mavenCoreCC = //
new DefaultContainerConfiguration().setClassWorld(//
classWorld).setRealm(//
realm).setClassPathScanning(//
PlexusConstants.SCANNING_INDEX).setAutoWiring(//
true).setName(// $NON-NLS-1$
"mavenCore");
final Module logginModule = new AbstractModule() {
protected void configure() {
bind(ILoggerFactory.class).toInstance(LoggerFactory.getILoggerFactory());
}
};
final Module coreExportsModule = new AbstractModule() {
protected void configure() {
ClassRealm realm = mavenCoreCC.getRealm();
CoreExtensionEntry entry = CoreExtensionEntry.discoverFrom(realm);
CoreExports exports = new CoreExports(entry);
bind(CoreExports.class).toInstance(exports);
}
};
return new DefaultPlexusContainer(mavenCoreCC, logginModule, coreExportsModule);
}
Aggregations