Java Code Examples for org.apache.maven.model.PluginExecution#setId()

The following examples show how to use org.apache.maven.model.PluginExecution#setId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PomChangePluginTest.java    From butterfly with MIT License 6 votes vote down vote up
@Test
public void changeExecutionsTest() throws IOException, XmlPullParserException {
    final PluginExecution pluginExecution = new PluginExecution();
    pluginExecution.setId("test-execution");
    pluginExecution.setPhase("build");
    pluginExecution.addGoal("clean install");
    List<PluginExecution> executions = new ArrayList<PluginExecution>(){{ add(pluginExecution); }};
    PomChangePlugin uut = new PomChangePlugin("org.codehaus.mojo", "build-helper-maven-plugin").relative("pom.xml").setExecutions(executions);

    assertFalse(getPluginBeforeChange(uut).getExecutions().isEmpty());
    assertNotEquals(getPluginBeforeChange(uut).getExecutions().size(), executions.size());
    assertFalse(getPluginBeforeChange(uut).getExecutionsAsMap().containsKey(pluginExecution.getId()));

    executeAndAssertSuccess(uut);

    assertFalse(getPluginAfterChange(uut).getExecutions().isEmpty());
    assertNotEquals(getPluginBeforeChange(uut).getExecutions().size(), getPluginAfterChange(uut).getExecutions().size());
    assertEquals(getPluginAfterChange(uut).getExecutions().size(), executions.size());
    assertTrue(getPluginAfterChange(uut).getExecutionsAsMap().containsKey(pluginExecution.getId()));
}
 
Example 2
Source File: GitVersioningModelProcessor.java    From maven-git-versioning-extension with MIT License 6 votes vote down vote up
private void addBuildPlugin(Model model, boolean updatePomOption) {
    logger.debug(model.getArtifactId() + " temporary add build plugin");

    Plugin plugin = asPlugin();

    PluginExecution execution = new PluginExecution();
    execution.setId(GOAL);
    execution.getGoals().add(GOAL);
    plugin.getExecutions().add(execution);

    if (model.getBuild() == null) {
        model.setBuild(new Build());
    }
    model.getBuild().getPlugins().add(plugin);

    // set plugin properties
    model.getProperties().setProperty(propertyKeyPrefix + propertyKeyUpdatePom, Boolean.toString(updatePomOption));
}
 
Example 3
Source File: CreateMavenBundlePom.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
private Plugin addOsgiHelperMavenPlugin() {
    Plugin plugin = new Plugin();

    plugin.setGroupId("org.talend.ci");
    plugin.setArtifactId("osgihelper-maven-plugin");
    plugin.setVersion(VersionUtils.getMojoVersion("osgihelper.version"));

    Xpp3Dom configuration = new Xpp3Dom("configuration");
    Xpp3Dom featuresFile = new Xpp3Dom("featuresFile");
    featuresFile.setValue(PATH_FEATURE);
    configuration.addChild(featuresFile);

    List<PluginExecution> pluginExecutions = new ArrayList<PluginExecution>();
    PluginExecution pluginExecution = new PluginExecution();
    pluginExecution.setId("feature-helper");
    pluginExecution.setPhase("generate-sources");
    pluginExecution.addGoal("generate");
    pluginExecution.setConfiguration(configuration);
    pluginExecutions.add(pluginExecution);
    plugin.setExecutions(pluginExecutions);

    return plugin;
}
 
Example 4
Source File: CreateMavenDataServicePom.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
private Plugin addOsgiHelperMavenPlugin() {
    Plugin plugin = new Plugin();

    plugin.setGroupId("org.talend.ci");
    plugin.setArtifactId("osgihelper-maven-plugin");
    plugin.setVersion(VersionUtils.getMojoVersion("osgihelper.version"));

    Xpp3Dom configuration = new Xpp3Dom("configuration");
    Xpp3Dom featuresFile = new Xpp3Dom("featuresFile");
    featuresFile.setValue("${basedir}/src/main/resources/feature/feature.xml");
    configuration.addChild(featuresFile);

    List<PluginExecution> pluginExecutions = new ArrayList<PluginExecution>();
    PluginExecution pluginExecution = new PluginExecution();
    pluginExecution.setId("feature-helper");
    pluginExecution.setPhase("generate-sources");
    pluginExecution.addGoal("generate");
    pluginExecution.setConfiguration(configuration);
    pluginExecutions.add(pluginExecution);
    plugin.setExecutions(pluginExecutions);

    return plugin;
}
 
Example 5
Source File: CreateMavenBundlePom.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
private Plugin addFeaturesMavenPlugin(String finalNameValue) {
    Plugin plugin = new Plugin();

    plugin.setGroupId("org.apache.karaf.tooling");
    plugin.setArtifactId("karaf-maven-plugin");
    plugin.setVersion("4.2.4");

    Xpp3Dom configuration = new Xpp3Dom("configuration");

    Xpp3Dom finalName = new Xpp3Dom("finalName");

    finalName.setValue(finalNameValue);// "${talend.job.finalName}"

    Xpp3Dom resourcesDir = new Xpp3Dom("resourcesDir");
    resourcesDir.setValue("${project.build.directory}/bin");

    Xpp3Dom featuresFile = new Xpp3Dom("featuresFile");
    featuresFile.setValue(PATH_FEATURE);

    configuration.addChild(finalName);
    configuration.addChild(resourcesDir);
    configuration.addChild(featuresFile);

    List<PluginExecution> pluginExecutions = new ArrayList<PluginExecution>();
    PluginExecution pluginExecution = new PluginExecution();
    pluginExecution.setId("create-kar");
    pluginExecution.addGoal("kar");
    pluginExecution.setConfiguration(configuration);

    pluginExecutions.add(pluginExecution);
    plugin.setExecutions(pluginExecutions);

    return plugin;
}
 
Example 6
Source File: CreateMavenDataServicePom.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
private Plugin addFeaturesMavenPlugin() {
    Plugin plugin = new Plugin();

    plugin.setGroupId("org.apache.karaf.tooling");
    plugin.setArtifactId("karaf-maven-plugin");
    plugin.setVersion("4.2.4");

    Xpp3Dom configuration = new Xpp3Dom("configuration");

    Xpp3Dom resourcesDir = new Xpp3Dom("resourcesDir");
    resourcesDir.setValue("${project.build.directory}/bin");

    Xpp3Dom featuresFile = new Xpp3Dom("featuresFile");
    featuresFile.setValue("${basedir}/src/main/resources/feature/feature.xml");

    configuration.addChild(resourcesDir);
    configuration.addChild(featuresFile);

    List<PluginExecution> pluginExecutions = new ArrayList<PluginExecution>();
    PluginExecution pluginExecution = new PluginExecution();
    pluginExecution.setId("create-kar");
    pluginExecution.addGoal("kar");
    pluginExecution.setConfiguration(configuration);

    pluginExecutions.add(pluginExecution);
    plugin.setExecutions(pluginExecutions);

    return plugin;
}