Search in sources :

Example 66 with Plugin

use of org.apache.maven.model.Plugin in project docker-maven-plugin by fabric8io.

the class MojoExecutionServiceTest method noDescriptor.

@Test(expected = MojoExecutionException.class)
public void noDescriptor() throws Exception {
    new Expectations() {

        {
            project.getPlugin(PLUGIN_NAME);
            result = new Plugin();
            pluginDescriptor.getMojo(GOAL_NAME);
            result = null;
            executionService.getPluginDescriptor((MavenProject) any, (Plugin) any);
        }
    };
    executionService.callPluginGoal(PLUGIN_NAME + ":" + GOAL_NAME);
    new Verifications() {

        {
        }
    };
}
Also used : Expectations(mockit.Expectations) Verifications(mockit.Verifications) Plugin(org.apache.maven.model.Plugin) Test(org.junit.Test)

Example 67 with Plugin

use of org.apache.maven.model.Plugin in project kie-wb-common by kiegroup.

the class MavenAPIUtil method getPlugin.

public static Plugin getPlugin(String groupdID, String artifactID, String version) {
    Plugin plugin = new Plugin();
    plugin.setGroupId(groupdID);
    plugin.setArtifactId(artifactID);
    plugin.setVersion(version);
    return plugin;
}
Also used : Plugin(org.apache.maven.model.Plugin)

Example 68 with Plugin

use of org.apache.maven.model.Plugin 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 69 with Plugin

use of org.apache.maven.model.Plugin in project kie-wb-common by kiegroup.

the class PomEditor method processKieMavenCompiler.

private void processKieMavenCompiler(List<Plugin> buildPlugins) {
    PluginPresence kieMavenCompiler = getPluginPresence(buildPlugins, KIE_PKG, KIE_MAVEN_PLUGIN_ARTIFACT_ID);
    if (!kieMavenCompiler.isPresent()) {
        buildPlugins.add(getKieMavenPlugin());
    } else {
        Plugin kieMavenPlugin = buildPlugins.get(kieMavenCompiler.getPosition());
        kieMavenPlugin.setVersion(kieVersion);
    }
}
Also used : Plugin(org.apache.maven.model.Plugin)

Example 70 with Plugin

use of org.apache.maven.model.Plugin in project kie-wb-common by kiegroup.

the class PomEditor method getPluginPresence.

private PluginPresence getPluginPresence(List<Plugin> plugins, String groupID, String artifactID) {
    boolean result = false;
    int i = 0;
    for (Plugin plugin : plugins) {
        if (plugin.getGroupId().equals(groupID) && plugin.getArtifactId().equals(artifactID)) {
            result = true;
            break;
        }
        i++;
    }
    return new PluginPresence(result, i);
}
Also used : Plugin(org.apache.maven.model.Plugin)

Aggregations

Plugin (org.apache.maven.model.Plugin)140 Xpp3Dom (org.codehaus.plexus.util.xml.Xpp3Dom)39 MavenProject (org.apache.maven.project.MavenProject)26 Build (org.apache.maven.model.Build)22 PluginExecution (org.apache.maven.model.PluginExecution)22 ArrayList (java.util.ArrayList)20 Dependency (org.apache.maven.model.Dependency)17 File (java.io.File)15 Model (org.apache.maven.model.Model)15 HashMap (java.util.HashMap)12 PluginDescriptor (org.apache.maven.plugin.descriptor.PluginDescriptor)12 CoreException (org.eclipse.core.runtime.CoreException)11 IOException (java.io.IOException)9 List (java.util.List)8 PluginManagement (org.apache.maven.model.PluginManagement)8 Map (java.util.Map)7 MavenSession (org.apache.maven.execution.MavenSession)7 ReportPlugin (org.apache.maven.model.ReportPlugin)7 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)7 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)6