Search in sources :

Example 16 with Xpp3Dom

use of org.codehaus.plexus.util.xml.Xpp3Dom in project fabric8-maven-plugin by fabric8io.

the class DockerServerUtil method getConfigurationValue.

private static String getConfigurationValue(final Server server, final String key) {
    final Xpp3Dom configuration = (Xpp3Dom) server.getConfiguration();
    if (configuration == null) {
        return null;
    }
    final Xpp3Dom node = configuration.getChild(key);
    if (node == null) {
        return null;
    }
    return node.getValue();
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom)

Example 17 with Xpp3Dom

use of org.codehaus.plexus.util.xml.Xpp3Dom in project fabric8-maven-plugin by fabric8io.

the class VertxPortsExtractor method getConfigPathFromProject.

@Override
public String getConfigPathFromProject(MavenProject project) {
    Plugin plugin = project.getPlugin(Constants.VERTX_MAVEN_PLUGIN_GA);
    if (plugin == null) {
        return null;
    }
    Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
    if (configuration == null) {
        return null;
    }
    Xpp3Dom config = configuration.getChild("config");
    return config != null ? config.getValue() : null;
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) Plugin(org.apache.maven.model.Plugin)

Example 18 with Xpp3Dom

use of org.codehaus.plexus.util.xml.Xpp3Dom 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;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) PluginDescriptor(org.apache.maven.plugin.descriptor.PluginDescriptor) ClassRealm(org.codehaus.plexus.classworlds.realm.ClassRealm) MojoDescriptor(org.apache.maven.plugin.descriptor.MojoDescriptor) Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) PluginParameterExpressionEvaluator(org.apache.maven.plugin.PluginParameterExpressionEvaluator) XmlPlexusConfiguration(org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration) PlexusConfiguration(org.codehaus.plexus.configuration.PlexusConfiguration) CoreException(org.eclipse.core.runtime.CoreException) XmlPlexusConfiguration(org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration) PluginParameterExpressionEvaluator(org.apache.maven.plugin.PluginParameterExpressionEvaluator) ExpressionEvaluator(org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator) DuplicateRealmException(org.codehaus.plexus.classworlds.realm.DuplicateRealmException) CoreException(org.eclipse.core.runtime.CoreException) ComponentConfigurationException(org.codehaus.plexus.component.configurator.ComponentConfigurationException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException)

Example 19 with Xpp3Dom

use of org.codehaus.plexus.util.xml.Xpp3Dom in project tycho by eclipse.

the class DefaultTargetPlatformConfigurationReaderTest method testExtraRequirementId.

@Test
public void testExtraRequirementId() throws Exception {
    Xpp3Dom dom = createConfigurationDom("type", "versionRange");
    try {
        configurationReader.readExtraRequirements(new TargetPlatformConfiguration(), dom);
        fail();
    } catch (BuildFailureException e) {
        assertTrue(e.getMessage().contains("Element <id> is missing in <extraRequirements><requirement> section."));
    }
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) BuildFailureException(org.eclipse.tycho.core.shared.BuildFailureException) TargetPlatformConfiguration(org.eclipse.tycho.core.TargetPlatformConfiguration) Test(org.junit.Test)

Example 20 with Xpp3Dom

use of org.codehaus.plexus.util.xml.Xpp3Dom in project tycho by eclipse.

the class DefaultTargetPlatformConfigurationReaderTest method createGavConfiguration.

private Xpp3Dom createGavConfiguration(String groupId, String artifactId, String version) {
    Xpp3Dom dom = new Xpp3Dom("artifact");
    if (groupId != null) {
        Xpp3Dom group = new Xpp3Dom("groupId");
        group.setValue(groupId);
        dom.addChild(group);
    }
    if (artifactId != null) {
        Xpp3Dom artifact = new Xpp3Dom("artifactId");
        artifact.setValue(artifactId);
        dom.addChild(artifact);
    }
    if (version != null) {
        Xpp3Dom ver = new Xpp3Dom("version");
        ver.setValue(version);
        dom.addChild(ver);
    }
    return dom;
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom)

Aggregations

Xpp3Dom (org.codehaus.plexus.util.xml.Xpp3Dom)156 Plugin (org.apache.maven.model.Plugin)39 File (java.io.File)26 ArrayList (java.util.ArrayList)18 PluginExecution (org.apache.maven.model.PluginExecution)18 IOException (java.io.IOException)13 HashMap (java.util.HashMap)11 Test (org.junit.Test)11 MavenSession (org.apache.maven.execution.MavenSession)10 MavenProject (org.apache.maven.project.MavenProject)10 Model (org.apache.maven.model.Model)9 Reader (java.io.Reader)8 Build (org.apache.maven.model.Build)8 TargetPlatformConfiguration (org.eclipse.tycho.core.TargetPlatformConfiguration)8 BuildFailureException (org.eclipse.tycho.core.shared.BuildFailureException)8 MojoExecution (org.apache.maven.plugin.MojoExecution)7 XmlPullParserException (org.codehaus.plexus.util.xml.pull.XmlPullParserException)7 Map (java.util.Map)6 Dependency (org.apache.maven.model.Dependency)6 StringReader (java.io.StringReader)5