Search in sources :

Example 71 with Xpp3Dom

use of org.codehaus.plexus.util.xml.Xpp3Dom in project kie-wb-common by kiegroup.

the class MavenAPIUtil method disableMavenCompilerAlreadyPresent.

public static void disableMavenCompilerAlreadyPresent(Plugin plugin) {
    Xpp3Dom skipMain = new Xpp3Dom(MavenConfig.MAVEN_SKIP_MAIN);
    skipMain.setValue(TRUE);
    Xpp3Dom skip = new Xpp3Dom(MavenConfig.MAVEN_SKIP);
    skip.setValue(TRUE);
    Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION);
    configuration.addChild(skipMain);
    configuration.addChild(skip);
    plugin.setConfiguration(configuration);
    PluginExecution exec = new PluginExecution();
    exec.setId(MavenConfig.MAVEN_DEFAULT_COMPILE);
    exec.setPhase(MavenConfig.MAVEN_PHASE_NONE);
    List<PluginExecution> executions = new ArrayList<>();
    executions.add(exec);
    plugin.setExecutions(executions);
}
Also used : PluginExecution(org.apache.maven.model.PluginExecution) Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) ArrayList(java.util.ArrayList)

Example 72 with Xpp3Dom

use of org.codehaus.plexus.util.xml.Xpp3Dom in project kie-wb-common by kiegroup.

the class MavenAPIUtil method getNewCompilerPlugin.

public static Plugin getNewCompilerPlugin(Map<ConfigurationKey, String> conf) {
    Plugin newCompilerPlugin = new Plugin();
    newCompilerPlugin.setGroupId(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_GROUP));
    newCompilerPlugin.setArtifactId(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_ARTIFACT));
    newCompilerPlugin.setVersion(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_VERSION));
    Xpp3Dom compilerId = new Xpp3Dom(MavenConfig.MAVEN_COMPILER_ID);
    compilerId.setValue(conf.get(ConfigurationKey.COMPILER));
    Xpp3Dom sourceVersion = new Xpp3Dom(MavenConfig.MAVEN_SOURCE);
    sourceVersion.setValue(conf.get(ConfigurationKey.SOURCE_VERSION));
    Xpp3Dom targetVersion = new Xpp3Dom(MavenConfig.MAVEN_TARGET);
    targetVersion.setValue(conf.get(ConfigurationKey.TARGET_VERSION));
    Xpp3Dom failOnError = new Xpp3Dom(MavenConfig.FAIL_ON_ERROR);
    failOnError.setValue(conf.get(ConfigurationKey.FAIL_ON_ERROR));
    Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION);
    configuration.addChild(compilerId);
    configuration.addChild(sourceVersion);
    configuration.addChild(targetVersion);
    configuration.addChild(failOnError);
    newCompilerPlugin.setConfiguration(configuration);
    PluginExecution execution = new PluginExecution();
    execution.setId(MavenCLIArgs.DEFAULT_COMPILE);
    execution.setGoals(Arrays.asList(MavenCLIArgs.COMPILE));
    execution.setPhase(MavenCLIArgs.COMPILE);
    newCompilerPlugin.setExecutions(Arrays.asList(execution));
    return newCompilerPlugin;
}
Also used : PluginExecution(org.apache.maven.model.PluginExecution) Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) Plugin(org.apache.maven.model.Plugin)

Example 73 with Xpp3Dom

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

the class MavenModelUtil method convertXpp.

private static Element convertXpp(Xpp3Dom xpp3Dom) {
    Element result;
    try {
        result = new Element(xpp3Dom.getName());
    } catch (IllegalNameException e) {
        return null;
    }
    Xpp3Dom[] children = xpp3Dom.getChildren();
    if (children == null || children.length == 0) {
        result.setText(xpp3Dom.getValue());
    } else {
        for (Xpp3Dom child : children) {
            Element element = convertXpp(child);
            if (element != null) {
                result.addContent(element);
            }
        }
    }
    return result;
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) Element(org.jdom.Element) IllegalNameException(org.jdom.IllegalNameException)

Example 74 with Xpp3Dom

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

the class WarPluginInfo method getMavenWarOverlayConfigs.

/**
     * Get config for any overlays that have been declared for the maven-war-plugin.
     * 
     * @return the list of overlay configs
     */
public List<OverlayConfig> getMavenWarOverlayConfigs() {
    if (_overlayConfigs == null) {
        getPlugin();
        if (_plugin == null)
            return Collections.emptyList();
        getDependentMavenWarIncludes();
        getDependentMavenWarExcludes();
        Xpp3Dom node = (Xpp3Dom) _plugin.getConfiguration();
        if (node == null)
            return Collections.emptyList();
        node = node.getChild("overlays");
        if (node == null)
            return Collections.emptyList();
        Xpp3Dom[] nodes = node.getChildren("overlay");
        if (nodes == null)
            return Collections.emptyList();
        _overlayConfigs = new ArrayList<OverlayConfig>();
        for (int i = 0; i < nodes.length; i++) {
            OverlayConfig overlayConfig = new OverlayConfig(nodes[i], _dependentMavenWarIncludes, _dependentMavenWarExcludes);
            _overlayConfigs.add(overlayConfig);
        }
    }
    return _overlayConfigs;
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom)

Example 75 with Xpp3Dom

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

the class WarPluginInfo method getMavenWarOverlayConfigAsString.

/**
     * @return the xml as a string
     */
public String getMavenWarOverlayConfigAsString() {
    getPlugin();
    if (_plugin == null)
        return "";
    Xpp3Dom node = (Xpp3Dom) _plugin.getConfiguration();
    if (node == null)
        return "";
    return node.toString();
}
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