public PluginDescriptor build( Reader reader ) throws PlexusConfigurationException { return build( reader, null ); }
public PluginDescriptor build( Reader reader ) throws PlexusConfigurationException { return build( reader, null ); }
private PluginDescriptor parsePluginDescriptor( InputStream is, Plugin plugin, String descriptorLocation ) throws PluginDescriptorParsingException { try { Reader reader = ReaderFactory.newXmlReader( is ); PluginDescriptor pluginDescriptor = builder.build( reader, descriptorLocation ); return pluginDescriptor; } catch ( IOException | PlexusConfigurationException e ) { throw new PluginDescriptorParsingException( plugin, descriptorLocation, e ); } }
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 PluginDescriptor build( Reader reader ) throws PlexusConfigurationException { return build( reader, null ); }
public PluginDescriptor build( Reader reader ) throws PlexusConfigurationException { return build( reader, null ); }
public PluginDescriptor getPluginDescriptor( SummaryPluginDescriptor summaryPluginDescriptor ) throws MavenEmbedderException { PluginDescriptor pluginDescriptor; try { InputStream is = classLoader.getResourceAsStream( "/plugins/" + summaryPluginDescriptor.getArtifactId() + ".xml" ); pluginDescriptor = pluginDescriptorBuilder.build( new InputStreamReader( is ) ); } catch ( PlexusConfigurationException e ) { throw new MavenEmbedderException( "Error retrieving plugin descriptor.", e ); } return pluginDescriptor; }
public PlexusConfiguration mojoConfigurationFor(Object mojoInstance, PlexusConfiguration pluginConfigurationFromMaven) throws ComponentConfigurationException { try (InputStream is = mojoInstance.getClass().getResourceAsStream("/META-INF/maven/plugin.xml")) { PluginDescriptor pd = pluginDescriptorBuilder.build(new InputStreamReader(is, "UTF-8")); // closes input stream too String goal = determineGoal(mojoInstance.getClass().getName(), pd); PlexusConfiguration defaultMojoConfiguration = pd.getMojo(goal).getMojoConfiguration(); PlexusConfiguration mojoConfiguration = extractAndMerge(goal, pluginConfigurationFromMaven, defaultMojoConfiguration); return mojoConfiguration; } catch (Exception e) { throw new ComponentConfigurationException(e); } }
public PlexusConfiguration mojoConfigurationFor(Object mojoInstance, PlexusConfiguration pluginConfigurationFromMaven) throws ComponentConfigurationException { try (InputStream is = mojoInstance.getClass().getResourceAsStream("/META-INF/maven/plugin.xml")) { PluginDescriptor pd = pluginDescriptorBuilder.build(new InputStreamReader(is, "UTF-8")); // closes input stream too String goal = determineGoal(mojoInstance.getClass().getName(), pd); PlexusConfiguration defaultMojoConfiguration = pd.getMojo(goal).getMojoConfiguration(); PlexusConfiguration mojoConfiguration = extractAndMerge(goal, pluginConfigurationFromMaven, defaultMojoConfiguration); return mojoConfiguration; } catch (Exception e) { throw new ComponentConfigurationException(e); } }
public static Collection<MojoDescriptor> readMojos(InputStream is) throws IOException, XmlPullParserException { Reader reader = ReaderFactory.newXmlReader(is); org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor; try { pluginDescriptor = new PluginDescriptorBuilder().build(reader); } catch (PlexusConfigurationException e) { Throwables.propagateIfPossible(e.getCause(), IOException.class, XmlPullParserException.class); throw Throwables.propagate(e); } List<MojoDescriptor> result = new ArrayList<>(); for (org.apache.maven.plugin.descriptor.MojoDescriptor mojo : pluginDescriptor.getMojos()) { result.add(toMojoDescriptor(mojo)); } return result; }
public static Collection<MojoDescriptor> readMojos(InputStream is) throws IOException, XmlPullParserException { Reader reader = ReaderFactory.newXmlReader(is); org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor; try { pluginDescriptor = new PluginDescriptorBuilder().build(reader); } catch (PlexusConfigurationException e) { Throwables.propagateIfPossible(e.getCause(), IOException.class, XmlPullParserException.class); throw Throwables.propagate(e); } List<MojoDescriptor> result = new ArrayList<>(); for (org.apache.maven.plugin.descriptor.MojoDescriptor mojo : pluginDescriptor.getMojos()) { result.add(toMojoDescriptor(mojo)); } return result; }
InterpolationFilterReader interpolationFilterReader = new InterpolationFilterReader(new BufferedReader(reader), contextData); PluginDescriptor pluginDescriptor = new PluginDescriptorBuilder().build(interpolationFilterReader);
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 ); } }
return builder.build( new FileReader( pluginXmlFile ) );