Search in sources :

Example 31 with PluginExecution

use of org.apache.maven.model.PluginExecution in project tests by datanucleus.

the class MultiConfigTestRunnerMojo method getExistingConfiguration.

private Xpp3Dom getExistingConfiguration(String executionId) {
    Map<String, PluginExecution> executionsMap = surefirePlugin().getExecutionsAsMap();
    PluginExecution pluginExecution = executionsMap.get(executionId);
    if (pluginExecution == null) {
        throw new RuntimeException("Invalid execution id specified: " + executionId + ". Valid values are: " + executionsMap.keySet());
    } else {
        return (Xpp3Dom) pluginExecution.getConfiguration();
    }
}
Also used : PluginExecution(org.apache.maven.model.PluginExecution) Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom)

Example 32 with PluginExecution

use of org.apache.maven.model.PluginExecution in project component-runtime by Talend.

the class TalendLifecycleExtension method afterProjectsRead.

@Override
public void afterProjectsRead(final MavenSession session) {
    final Optional<Plugin> plugin = session.getCurrentProject().getBuild().getPlugins().stream().filter(p -> "${project.groupId}".equals(p.getGroupId()) && "${project.artifactId}".equals(p.getArtifactId())).findFirst();
    final List<PluginExecution> executions;
    if (plugin.isPresent()) {
        executions = plugin.get().getExecutions();
    } else {
        final Plugin def = new Plugin();
        def.setGroupId("${project.groupId}");
        def.setArtifactId("${project.artifactId}");
        def.setVersion("${project.version}");
        session.getCurrentProject().getBuild().getPlugins().add(def);
        executions = def.getExecutions();
    }
    if (isExecutionMissing(executions, "validate")) {
        final PluginExecution validate = new PluginExecution();
        validate.setId("talend-validate");
        validate.addGoal("validate");
        validate.setPhase("process-classes");
        executions.add(validate);
    }
    if (isExecutionMissing(executions, "dependencies")) {
        final PluginExecution dependencies = new PluginExecution();
        dependencies.setId("talend-dependencies");
        dependencies.addGoal("dependencies");
        dependencies.setPhase("process-classes");
        executions.add(dependencies);
    }
    if (isExecutionMissing(executions, "asciidoc")) {
        final PluginExecution documentation = new PluginExecution();
        documentation.setId("talend-dependencies");
        documentation.addGoal("asciidoc");
        documentation.setPhase("process-classes");
        executions.add(documentation);
    }
}
Also used : AbstractMavenLifecycleParticipant(org.apache.maven.AbstractMavenLifecycleParticipant) List(java.util.List) Plugin(org.apache.maven.model.Plugin) PluginExecution(org.apache.maven.model.PluginExecution) MavenSession(org.apache.maven.execution.MavenSession) Optional(java.util.Optional) Component(org.codehaus.plexus.component.annotations.Component) PluginExecution(org.apache.maven.model.PluginExecution) Plugin(org.apache.maven.model.Plugin)

Aggregations

PluginExecution (org.apache.maven.model.PluginExecution)32 Plugin (org.apache.maven.model.Plugin)22 Xpp3Dom (org.codehaus.plexus.util.xml.Xpp3Dom)18 ArrayList (java.util.ArrayList)8 Build (org.apache.maven.model.Build)6 Dependency (org.apache.maven.model.Dependency)6 Model (org.apache.maven.model.Model)5 HashMap (java.util.HashMap)4 LinkedHashMap (java.util.LinkedHashMap)4 Map (java.util.Map)4 Element (org.jdom.Element)4 Iterator (java.util.Iterator)3 MavenProject (org.apache.maven.project.MavenProject)3 ManipulationException (org.commonjava.maven.ext.common.ManipulationException)3 File (java.io.File)2 ConfigurationContainer (org.apache.maven.model.ConfigurationContainer)2 Repository (org.apache.maven.model.Repository)2 ProjectVersionRef (org.commonjava.maven.atlas.ident.ref.ProjectVersionRef)2 Project (org.commonjava.maven.ext.common.model.Project)2 CorePlugin (org.talend.core.CorePlugin)2