@SuppressWarnings( { "unchecked", "rawtypes" } ) public List<MojoDescriptor> getMojos() { return (List) getComponents(); }
@SuppressWarnings( { "unchecked", "rawtypes" } ) public List<MojoDescriptor> getMojos() { return (List) getComponents(); }
private void discoverPluginComponents( final ClassRealm pluginRealm, Plugin plugin, PluginDescriptor pluginDescriptor ) throws PluginContainerException { try { if ( pluginDescriptor != null ) { for ( ComponentDescriptor<?> componentDescriptor : pluginDescriptor.getComponents() ) { componentDescriptor.setRealm( pluginRealm ); container.addComponentDescriptor( componentDescriptor ); } } ( (DefaultPlexusContainer) container ).discoverComponents( pluginRealm, new SessionScopeModule( container ), new MojoExecutionScopeModule( container ) ); } catch ( ComponentLookupException | CycleDetectedInComponentGraphException e ) { throw new PluginContainerException( plugin, pluginRealm, "Error in component graph of plugin " + plugin.getId() + ": " + e.getMessage(), e ); } }
List<Artifact> pluginArtifacts = extensionRecord.getArtifacts(); for ( ComponentDescriptor<?> componentDescriptor : pluginDescriptor.getComponents() ) for ( ComponentDescriptor<?> componentDescriptor : pluginDescriptor.getComponents() )
protected void setUp() throws Exception { assertTrue( "Maven 3.2.4 or better is required", MAVEN_VERSION == null || new DefaultArtifactVersion( "3.2.3" ).compareTo( MAVEN_VERSION ) < 0 ); configurator = getContainer().lookup( ComponentConfigurator.class, "basic" ); InputStream is = getClass().getResourceAsStream( "/" + getPluginDescriptorLocation() ); XmlStreamReader reader = new XmlStreamReader( is ); InterpolationFilterReader interpolationFilterReader = new InterpolationFilterReader( new BufferedReader( reader ), container.getContext().getContextData() ); PluginDescriptor pluginDescriptor = new PluginDescriptorBuilder().build( interpolationFilterReader ); Artifact artifact = lookup( RepositorySystem.class ).createArtifact( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId(), pluginDescriptor.getVersion(), ".jar" ); artifact.setFile( getPluginArtifactFile() ); pluginDescriptor.setPluginArtifact( artifact ); pluginDescriptor.setArtifacts( Arrays.asList( artifact ) ); for ( ComponentDescriptor<?> desc : pluginDescriptor.getComponents() ) { getContainer().addComponentDescriptor( desc ); } mojoDescriptors = new HashMap<String, MojoDescriptor>(); for ( MojoDescriptor mojoDescriptor : pluginDescriptor.getMojos() ) { mojoDescriptors.put( mojoDescriptor.getGoal(), mojoDescriptor ); } }
public List getMojos() { return getComponents(); }
@SuppressWarnings( { "unchecked", "rawtypes" } ) public List<MojoDescriptor> getMojos() { return (List) getComponents(); }
public void addMojo( MojoDescriptor mojoDescriptor ) throws DuplicateMojoDescriptorException { MojoDescriptor existing = null; // this relies heavily on the equals() and hashCode() for ComponentDescriptor, // which uses role:roleHint for identity...and roleHint == goalPrefix:goal. // role does not vary for Mojos. List mojos = getComponents(); if ( mojos != null && mojos.contains( mojoDescriptor ) ) { int indexOf = mojos.indexOf( mojoDescriptor ); existing = (MojoDescriptor) mojos.get( indexOf ); } if ( existing != null ) { throw new DuplicateMojoDescriptorException( getGoalPrefix(), mojoDescriptor.getGoal(), existing .getImplementation(), mojoDescriptor.getImplementation() ); } else { addComponentDescriptor( mojoDescriptor ); } }
pluginDescriptor.setArtifacts(Arrays.asList(artifact)); for (ComponentDescriptor<?> desc : pluginDescriptor.getComponents()) { container.addComponentDescriptor(desc);
protected void setUp() throws Exception { configurator = getContainer().lookup( ComponentConfigurator.class, "basic" ); InputStream is = getClass().getResourceAsStream( "/" + getPluginDescriptorLocation() ); XmlStreamReader reader = new XmlStreamReader( is ); InterpolationFilterReader interpolationFilterReader = new InterpolationFilterReader( new BufferedReader( reader ), container.getContext().getContextData() ); PluginDescriptor pluginDescriptor = new PluginDescriptorBuilder().build( interpolationFilterReader ); Artifact artifact = lookup( RepositorySystem.class ).createArtifact( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId(), pluginDescriptor.getVersion(), ".jar" ); artifact.setFile( new File( getBasedir() ).getCanonicalFile() ); pluginDescriptor.setPluginArtifact( artifact ); pluginDescriptor.setArtifacts( Arrays.asList( artifact ) ); for ( ComponentDescriptor<?> desc : pluginDescriptor.getComponents() ) { getContainer().addComponentDescriptor( desc ); } mojoDescriptors = new HashMap<String, MojoDescriptor>(); for ( MojoDescriptor mojoDescriptor : pluginDescriptor.getMojos() ) { mojoDescriptors.put( mojoDescriptor.getGoal(), mojoDescriptor ); } }