use of org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration in project intellij-plugins by JetBrains.
the class AdditionalSourceRootUtil method addByBuildHelper.
public static void addByBuildHelper(MojoExecution mojoExecution, MavenSession session, MavenProject project, Logger logger) {
final PlexusConfiguration parentConfiguration = new XmlPlexusConfiguration(mojoExecution.getConfiguration());
final PlexusConfiguration configuration = parentConfiguration.getChild("sources");
if (configuration == null) {
return;
}
final PlexusConfiguration[] sources = configuration.getChildren();
if (sources == null) {
return;
}
final ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator(session, mojoExecution);
for (PlexusConfiguration source : sources) {
addFile(evaluate(expressionEvaluator, source.getValue(), logger), project, expressionEvaluator);
}
}
use of org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration in project intellij-plugins by JetBrains.
the class AdditionalSourceRootUtil method addByGeneratorMojo.
public static void addByGeneratorMojo(MojoExecution mojoExecution, MavenSession session, MavenProject project, Logger logger) {
final PluginParameterExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator(session, mojoExecution);
final PlexusConfiguration configuration = new XmlPlexusConfiguration(mojoExecution.getConfiguration());
for (String parameterName : new String[] { "baseOutputDirectory", "outputDirectory" }) {
collectGeneratedSource(configuration, parameterName, project, expressionEvaluator, logger);
}
}
use of org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration in project m2e-nar by maven-nar.
the class MavenUtils method getConfiguredMojo.
private static <T extends AbstractMojo> T getConfiguredMojo(MavenSession session, MojoExecution mojoExecution, Class<T> asType, Log log) throws CoreException {
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
ClassRealm pluginRealm = getMyRealm(pluginDescriptor.getClassRealm().getWorld());
T mojo;
try {
mojo = asType.newInstance();
} catch (Exception e) {
throw new CoreException(new Status(IStatus.ERROR, MavenNarPlugin.PLUGIN_ID, "Problem when creating mojo", e));
}
mojo.setLog(log);
logger.debug("Configuring mojo " + mojoDescriptor.getId() + " from plugin realm " + pluginRealm);
Xpp3Dom dom = mojoExecution.getConfiguration();
PlexusConfiguration pomConfiguration;
if (dom == null) {
pomConfiguration = new XmlPlexusConfiguration("configuration");
} else {
pomConfiguration = new XmlPlexusConfiguration(dom);
}
ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator(session, mojoExecution);
populatePluginFields(mojo, mojoDescriptor, pluginRealm, pomConfiguration, expressionEvaluator);
return mojo;
}
use of org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration in project tycho by eclipse.
the class AbstractTychoMojoTestCase method lookupMojoWithDefaultConfiguration.
/**
* Returns a mojo configured with the mojo's default configuration.
*/
// workaround for MPLUGINTESTING-46 - see http://jira.codehaus.org/browse/MPLUGINTESTING-46
protected Mojo lookupMojoWithDefaultConfiguration(MavenProject project, MavenSession session, String goal) throws Exception {
MojoExecution mojoExecution = newMojoExecution(goal);
Xpp3Dom defaultConfiguration = mojoExecution.getConfiguration();
// the ResolverExpressionEvaluatorStub of lookupMojo is not sufficient to evaluate the variables in the default configuration
ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator(session, mojoExecution);
ComponentConfigurator configurator = getContainer().lookup(ComponentConfigurator.class, "basic");
Mojo mojo = lookupEmptyMojo(goal, project.getFile());
configurator.configureComponent(mojo, new XmlPlexusConfiguration(defaultConfiguration), expressionEvaluator, getContainer().getContainerRealm(), null);
return mojo;
}
use of org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration in project revapi by revapi.
the class SchemaDrivenJSONToXmlConverter method convertArray.
private static PlexusConfiguration convertArray(ModelNode configuration, ConversionContext ctx) {
ModelNode itemsSchema = ctx.currentSchema.get("items");
if (!itemsSchema.isDefined()) {
throw new IllegalArgumentException("No schema found for items of a list. Cannot continue with XML-to-JSON conversion.");
}
PlexusConfiguration list = new XmlPlexusConfiguration(ctx.tagName);
if (ctx.id != null) {
list.setAttribute("id", ctx.id);
}
for (ModelNode childConfig : configuration.asList()) {
ctx.tagName = "item";
ctx.currentSchema = itemsSchema;
ctx.id = null;
ctx.currentPath.push("[]");
PlexusConfiguration child = convert(childConfig, ctx);
ctx.currentPath.pop();
list.addChild(child);
}
return list;
}
Aggregations