本文整理汇总了Java中org.apache.maven.model.Plugin.addExecution方法的典型用法代码示例。如果您正苦于以下问题:Java Plugin.addExecution方法的具体用法?Java Plugin.addExecution怎么用?Java Plugin.addExecution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.Plugin
的用法示例。
在下文中一共展示了Plugin.addExecution方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPlugin
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
protected Plugin createPlugin(String groupId, String artifactId, String version, String configuration,
String executionId, String goal, String phase) throws MavenExecutionException {
Plugin plugin = new Plugin();
plugin.setGroupId(groupId);
plugin.setArtifactId(artifactId);
plugin.setVersion(version);
PluginExecution execution = new PluginExecution();
execution.setId(executionId);
execution.addGoal(goal);
if (phase != null) {
execution.setPhase(phase);
}
if (configuration != null) {
execution.setConfiguration(mavenConfig.asXpp3Dom(configuration));
}
plugin.addExecution(execution);
return plugin;
}
示例2: getEnforcerPlugin
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
public Plugin getEnforcerPlugin(MavenProject project)
throws MavenExecutionException {
StringBuilder configString = new StringBuilder()
.append("<configuration><rules>")
.append("<requireReleaseDeps><message>No Snapshots Allowed!</message><excludes><exclude>"+project.getGroupId()+":*</exclude></excludes></requireReleaseDeps>")
.append("</rules></configuration>");
Xpp3Dom config = null;
try {
config = Xpp3DomBuilder.build(new StringReader(configString.toString()));
} catch (XmlPullParserException | IOException ex) {
throw new MavenExecutionException("Issue creating cofig for enforcer plugin", ex);
}
PluginExecution execution = new PluginExecution();
execution.setId("no-snapshot-deps");
execution.addGoal("enforce");
execution.setConfiguration(config);
Plugin result = new Plugin();
result.setArtifactId("maven-enforcer-plugin");
result.setVersion("1.4.1");
result.addExecution(execution);
return result;
}
示例3: testExecuteInParentWithConfigurationInExecution
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
* Test of execute method, of class RequirePropertyDiverges.
*/
@Test
public void testExecuteInParentWithConfigurationInExecution() throws EnforcerRuleException
{
RequirePropertyDiverges mockInstance = createMockRule();
final MavenProject project = createMavenProject( "company", "company-parent-pom" );
final Build build = new Build();
build.setPluginManagement( new PluginManagement() );
final Plugin plugin = newPlugin( "org.apache.maven.plugins", "maven-enforcer-plugin", "1.0" );
final Xpp3Dom configuration = createPluginConfiguration();
PluginExecution pluginExecution = new PluginExecution();
pluginExecution.setConfiguration( configuration );
plugin.addExecution( pluginExecution );
build.addPlugin( plugin );
project.getOriginalModel().setBuild( build );
setUpHelper(project, "parentValue");
mockInstance.execute( helper );
}
示例4: getVersionFixPlugin
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
public Plugin getVersionFixPlugin() {
PluginExecution execution = new PluginExecution();
execution.setId("versionfix");
execution.addGoal("versionfix");
Plugin result = new Plugin();
result.setGroupId("com.iggroup.maven.cdversion");
result.setArtifactId("versionfix-maven-plugin");
result.setVersion("${project.version}");
result.addExecution(execution);
return result;
}
示例5: testMerge_pluginFoundWithExecutions
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
@Test
public void testMerge_pluginFoundWithExecutions() {
PluginExecution buildExec = new PluginExecution();
buildExec.setId("random-execution-id");
buildExec.setGoals(Arrays.asList("some-goal"));
buildExec.setPhase("random-phase");
buildExec.setPriority(1);
Plugin buildPlugin = new Plugin();
buildPlugin.setArtifactId("merge-artifact");
buildPlugin.addExecution(buildExec);
List<Plugin> plugins = project.getBuild().getPlugins();
plugins.addAll(dummyPlugins);
plugins.add(buildPlugin);
PluginExecution mergeExec = new PluginExecution();
mergeExec.setId("merge-execution-id");
mergeExec.setGoals(Arrays.asList("some-goal"));
mergeExec.setPhase("random-phase");
mergeExec.setPriority(1);
Plugin mergePlugin = new Plugin();
mergePlugin.setArtifactId("merge-artifact");
mergePlugin.getExecutions().add(mergeExec);
item.merge(project, mergePlugin);
Plugin expectedPlugin = new Plugin();
expectedPlugin.setArtifactId("merge-artifact");
expectedPlugin.getExecutions().add(buildExec);
expectedPlugin.getExecutions().add(mergeExec);
Assert.assertEquals("Plugins.Size", dummyPlugins.size() + 1, project.getBuildPlugins().size());
for (int i = 0; i < dummyPlugins.size(); i++) {
Assert.assertThat("Plugins["+i+"]", project.getBuildPlugins().get(i), Matchers.sameBeanAs(dummyPlugins.get(i)));
}
Assert.assertThat("Plugins["+dummyPlugins.size()+"]", project.getBuildPlugins().get(dummyPlugins.size()), Matchers.sameBeanAs(expectedPlugin));
}
示例6: testMerge_pluginFoundWithConflictingExecutions
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
@Test
public void testMerge_pluginFoundWithConflictingExecutions() {
PluginExecution buildExec = new PluginExecution();
buildExec.setId("merge-execution-id");
buildExec.setGoals(Arrays.asList("original-goal"));
buildExec.setPhase("original-phase");
buildExec.setPriority(1);
Plugin buildPlugin = new Plugin();
buildPlugin.setArtifactId("merge-artifact");
buildPlugin.addExecution(buildExec);
List<Plugin> plugins = project.getBuild().getPlugins();
plugins.addAll(dummyPlugins);
plugins.add(buildPlugin);
PluginExecution mergeExec = new PluginExecution();
mergeExec.setId("merge-execution-id");
mergeExec.setGoals(Arrays.asList("merge-goal"));
mergeExec.setPhase("merge-phase");
mergeExec.setPriority(2);
Plugin mergePlugin = new Plugin();
mergePlugin.setArtifactId("merge-artifact");
mergePlugin.getExecutions().add(mergeExec);
item.merge(project, mergePlugin);
Plugin expectedPlugin = new Plugin();
expectedPlugin.setArtifactId("merge-artifact");
expectedPlugin.getExecutions().add(buildExec);
Assert.assertEquals("Plugins.Size", dummyPlugins.size() + 1, project.getBuildPlugins().size());
for (int i = 0; i < dummyPlugins.size(); i++) {
Assert.assertThat("Plugins["+i+"]", project.getBuildPlugins().get(i), Matchers.sameBeanAs(dummyPlugins.get(i)));
}
Assert.assertThat("Plugins["+dummyPlugins.size()+"]", project.getBuildPlugins().get(dummyPlugins.size()), Matchers.sameBeanAs(expectedPlugin));
}
示例7: addPluginExecution
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private void addPluginExecution(Plugin plugin, String goal, Phase phase) {
PluginExecution pluginExecution = new PluginExecution();
pluginExecution.addGoal(goal);
pluginExecution.setPhase(phase.toString());
plugin.addExecution(pluginExecution);
}