Refine search
public void initTreeProcessing( PlexusContainer plexus ) throws ComponentLookupException { classpathTransformation = plexus.lookup( ClasspathTransformation.class ); conflictResolver = plexus.lookup( GraphConflictResolver.class ); } //----------------------------------------------------------------------------
@Inject public BootstrapCoreExtensionManager( Logger log, DefaultPluginDependenciesResolver pluginDependenciesResolver, DefaultRepositorySystemSessionFactory repositorySystemSessionFactory, PlexusContainer container ) { this.log = log; this.pluginDependenciesResolver = pluginDependenciesResolver; this.repositorySystemSessionFactory = repositorySystemSessionFactory; this.classWorld = ( (DefaultPlexusContainer) container ).getClassWorld(); this.parentRealm = container.getContainerRealm(); }
container.addContextValue("SystemProperties", systemProperties); try activators = container.lookupList( ProfileActivator.ROLE ); container.getContext().put("SystemProperties", null); if ( activators != null ) container.releaseAll( activators ); container.getLogger().debug( "Error releasing profile activators - ignoring.", e );
/** * Allows us to pull the ArchiverManager instance out of the container without causing a chicken-and-egg * instantiation/composition problem. */ @Override public void contextualize( final Context context ) throws ContextException { final PlexusContainer container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY ); try { archiverManager = (ArchiverManager) container.lookup( ArchiverManager.ROLE ); } catch ( final ComponentLookupException e ) { throw new ContextException( "Error retrieving ArchiverManager instance: " + e.getMessage(), e ); } }
protected Object lookup( String role, String roleHint, ClassRealm realm ) { try { return container.lookup( role, roleHint, realm ); } catch ( ComponentLookupException e ) { logger.debug( "Failed to lookup a member of active collection with role: " + role + " and role-hint: " + roleHint + "\nin realm: " + realm, e ); return null; } }
if ( logger.isDebugEnabled() ) logger.debug( "Configuring mojo " + mojoDescriptor.getId() + " from plugin realm " + pluginRealm ); ClassRealm oldLookupRealm = container.setLookupRealm( pluginRealm ); mojo = container.lookup( mojoInterface, mojoDescriptor.getRoleHint() ); Throwable cause = e.getCause(); while ( cause != null && !( cause instanceof LinkageError ) && !( cause instanceof ClassNotFoundException ) ) container.setLookupRealm( oldLookupRealm );
source = container.lookup( ArtifactMetadataSource.class ); if ( logger.isDebugEnabled() ) || result.hasCircularDependencyExceptions() ) logger.info( "Failure detected." ); return result;
configurator = container.lookup( ComponentConfigurator.class, configuratorId ); new ValidatingConfigurationListener( mojo, mojoDescriptor, listener ); logger.debug( "Configuring mojo '" + mojoDescriptor.getId() + "' with " + configuratorId + " configurator -->" ); logger.debug( "-- end configuration --" ); container.release( configurator ); logger.debug( "Failed to release mojo configurator - ignoring." );
LoggerManager loggerManager = (LoggerManager) getContainer().lookup( LoggerManager.class ); configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() );
lifecycleListeners.addAll( container.lookupList( AbstractMavenLifecycleParticipant.class ) ); logger.warn( "Failed to lookup lifecycle participants: " + e.getMessage() ); lifecycleListeners.addAll( container.lookupList( AbstractMavenLifecycleParticipant.class ) ); logger.warn( "Failed to lookup lifecycle participants: " + e.getMessage() );
public void contextualize( final Context context ) throws ContextException { PlexusContainer container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY ); this.realm = container.getContainerRealm(); try { configurator = (ComponentConfigurator) container.lookup( ComponentConfigurator.ROLE ); } catch ( ComponentLookupException e ) { throw new ContextException( "Failed to lookup component configurator: " + e.getMessage(), e ); } }
public void releaseMojo( Object mojo, MojoExecution mojoExecution ) { if ( mojo != null ) { try { container.release( mojo ); } catch ( ComponentLifecycleException e ) { String goalExecId = mojoExecution.getGoal(); if ( mojoExecution.getExecutionId() != null ) { goalExecId += " {execution: " + mojoExecution.getExecutionId() + "}"; } logger.debug( "Error releasing mojo for " + goalExecId, e ); } } }
private String getClassPath() { String pathSeparator = System.getProperty("path.separator", ":"); StringBuilder sb = new StringBuilder(); for (ClassRealm realm : container.getContainerRealm().getWorld().getRealms()) { if (realm.getId().contains("io.takari.polyglot:polyglot-java")) { for (URL jarURL : Arrays.asList(realm.getURLs())) { if (sb.length() > 0) { sb.append(pathSeparator); } sb.append(jarURL.getPath()); } } if (realm.getId().contains("plexus.core")) { for (URL jarURL : Arrays.asList(realm.getURLs())) { if (jarURL.getPath().contains("commons-lang3") || jarURL.getPath().contains("plexus-utils") || jarURL.getPath().contains("maven-model-3")) { if (sb.length() > 0) { sb.append(pathSeparator); } sb.append(jarURL.getPath().replaceAll("/bin/..", "")); } } } } String classPath = sb.toString(); log.debug("Calculated classpath for dynamic POM.java compilation as " + classPath); return classPath; }
private void releaseWagon( String protocol, Wagon wagon, String repositoryId ) { String hint = getWagonHint( protocol, repositoryId ); PlexusContainer container = getWagonContainer( hint ); try { container.release( wagon ); } catch ( ComponentLifecycleException e ) { getLogger().error( "Problem releasing wagon - ignoring: " + e.getMessage() ); } }
public void release( Object component ) throws ComponentLifecycleException { container.release( component ); }
protected void tearDown() throws Exception { if ( container != null ) { container.dispose(); container = null; } }
@Deprecated public List<Object> lookupList( String role ) throws ComponentLookupException { return container.lookupList( role ); }