List of usage examples for org.apache.maven.plugin.descriptor MojoDescriptor getRole
public String getRole()
From source file:org.codehaus.mojo.xml.test.AbstractXmlMojoTestCase.java
License:Apache License
@Override //In maven-plugin-testing-harnes 2.1, this method had a simple error in it which resulted in //the configuration being incorrectly generated. In later versions, the error has been corrected. //The error is annotated in the comments below. This method should be removed when upgrading to later //versions. protected Mojo lookupConfiguredMojo(MavenSession session, MojoExecution execution) throws Exception, ComponentConfigurationException { MavenProject project = session.getCurrentProject(); MojoDescriptor mojoDescriptor = execution.getMojoDescriptor(); Mojo mojo = (Mojo) lookup(mojoDescriptor.getRole(), mojoDescriptor.getRoleHint()); ExpressionEvaluator evaluator = new PluginParameterExpressionEvaluator(session, execution); Xpp3Dom configuration = null;/*from w ww .ja v a 2 s. c o m*/ Plugin plugin = project.getPlugin(mojoDescriptor.getPluginDescriptor().getPluginLookupKey()); if (plugin != null) { configuration = (Xpp3Dom) plugin.getConfiguration(); } if (configuration == null) { configuration = new Xpp3Dom("configuration"); } //FIX: the parameters were in the wrong order on this call - they have been reversed configuration = Xpp3Dom.mergeXpp3Dom(configuration, execution.getConfiguration()); //END FIX PlexusConfiguration pluginConfiguration = new XmlPlexusConfiguration(configuration); getContainer().lookup(ComponentConfigurator.class, "basic").configureComponent(mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm()); return mojo; }