本文整理汇总了Java中org.apache.maven.model.PluginExecution.setId方法的典型用法代码示例。如果您正苦于以下问题:Java PluginExecution.setId方法的具体用法?Java PluginExecution.setId怎么用?Java PluginExecution.setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.PluginExecution
的用法示例。
在下文中一共展示了PluginExecution.setId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPlugin
import org.apache.maven.model.PluginExecution; //导入方法依赖的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.PluginExecution; //导入方法依赖的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: testMerge_pluginFoundWithNoExecutions
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
@Test
public void testMerge_pluginFoundWithNoExecutions() {
Plugin buildPlugin = new Plugin();
buildPlugin.setArtifactId("merge-artifact");
List<Plugin> plugins = project.getBuild().getPlugins();
plugins.addAll(dummyPlugins);
plugins.add(buildPlugin);
PluginExecution exec = new PluginExecution();
exec.setId("merge-execution-id");
exec.setGoals(Arrays.asList("some-goal"));
exec.setPhase("random-phase");
exec.setPriority(1);
Plugin mergePlugin = new Plugin();
mergePlugin.setArtifactId("merge-artifact");
mergePlugin.getExecutions().add(exec);
item.merge(project, mergePlugin);
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(mergePlugin));
}
示例4: getJavadocPlugin
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private static Plugin getJavadocPlugin() {
final Plugin javadocPlugin = new Plugin();
javadocPlugin.setGroupId("org.apache.maven.plugins");
javadocPlugin.setArtifactId("maven-javadoc-plugin");
//javadocPlugin.setVersion("2.10.4");
PluginExecution pluginExecution = new PluginExecution();
pluginExecution.setId("javadoc");
List<String> goals = new ArrayList<>();
goals.add("jar");
pluginExecution.setGoals(goals);
pluginExecution.setPhase("package");
List<PluginExecution> pluginExecutions = new ArrayList<>();
pluginExecutions.add(pluginExecution);
javadocPlugin.setExecutions(pluginExecutions);
final Xpp3Dom javadocConfig = new Xpp3Dom("configuration");
final Xpp3Dom quiet = new Xpp3Dom("quiet");
quiet.setValue("true");
javadocConfig.addChild(quiet);
javadocPlugin.setConfiguration(javadocConfig);
return javadocPlugin;
}
示例5: getSourcePlugin
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private static Plugin getSourcePlugin() {
final Plugin sourcePlugin = new Plugin();
sourcePlugin.setGroupId("org.apache.maven.plugins");
sourcePlugin.setArtifactId("maven-source-plugin");
PluginExecution pluginExecution = new PluginExecution();
pluginExecution.setId("attach-sources");
List<String> goals = new ArrayList<>();
goals.add("jar");
pluginExecution.setGoals(goals);
pluginExecution.setPhase("package");
List<PluginExecution> pluginExecutions = new ArrayList<>();
pluginExecutions.add(pluginExecution);
sourcePlugin.setExecutions(pluginExecutions);
return sourcePlugin;
}
示例6: newPlugin
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private Plugin newPlugin( String artifactId, String... goals )
{
Plugin plugin = new Plugin();
plugin.setGroupId( "org.apache.maven.plugins" );
plugin.setArtifactId( artifactId );
for ( String goal : goals )
{
PluginExecution pluginExecution = new PluginExecution();
pluginExecution.setId( "default-" + goal );
pluginExecution.addGoal( goal );
plugin.addExecution( pluginExecution );
}
return plugin;
}
示例7: testShouldInheritOnePluginWithExecution
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
public void testShouldInheritOnePluginWithExecution()
{
Plugin parent = new Plugin();
parent.setArtifactId( "testArtifact" );
parent.setGroupId( "testGroup" );
parent.setVersion( "1.0" );
PluginExecution parentExecution = new PluginExecution();
parentExecution.setId( "testExecution" );
parent.addExecution( parentExecution );
Plugin child = new Plugin();
child.setArtifactId( "testArtifact" );
child.setGroupId( "testGroup" );
child.setVersion( "1.0" );
ModelUtils.mergePluginDefinitions( child, parent, false );
assertEquals( 1, child.getExecutions().size() );
}
示例8: testShouldMergeInheritedPluginHavingExecutionWithLocalPlugin
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
public void testShouldMergeInheritedPluginHavingExecutionWithLocalPlugin()
{
Plugin parent = new Plugin();
parent.setArtifactId( "testArtifact" );
parent.setGroupId( "testGroup" );
parent.setVersion( "1.0" );
PluginExecution parentExecution = new PluginExecution();
parentExecution.setId( "testExecution" );
parent.addExecution( parentExecution );
Plugin child = new Plugin();
child.setArtifactId( "testArtifact" );
child.setGroupId( "testGroup" );
child.setVersion( "1.0" );
PluginExecution childExecution = new PluginExecution();
childExecution.setId( "testExecution2" );
child.addExecution( childExecution );
ModelUtils.mergePluginDefinitions( child, parent, false );
assertEquals( 2, child.getExecutions().size() );
}
示例9: testShouldNOTMergeInheritedPluginHavingInheritEqualFalse
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
public void testShouldNOTMergeInheritedPluginHavingInheritEqualFalse()
{
Plugin parent = new Plugin();
parent.setArtifactId( "testArtifact" );
parent.setGroupId( "testGroup" );
parent.setVersion( "1.0" );
parent.setInherited( "false" );
PluginExecution parentExecution = new PluginExecution();
parentExecution.setId( "testExecution" );
parent.addExecution( parentExecution );
Plugin child = new Plugin();
child.setArtifactId( "testArtifact" );
child.setGroupId( "testGroup" );
child.setVersion( "1.0" );
ModelUtils.mergePluginDefinitions( child, parent, true );
assertEquals( 0, child.getExecutions().size() );
}
示例10: getNewCompilerPlugin
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
protected Plugin getNewCompilerPlugin() {
Plugin newCompilerPlugin = new Plugin();
newCompilerPlugin.setGroupId(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGINS));
newCompilerPlugin.setArtifactId(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGIN));
newCompilerPlugin.setVersion(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGIN_VERSION));
PluginExecution execution = new PluginExecution();
execution.setId(MavenCLIArgs.COMPILE);
execution.setGoals(Arrays.asList(MavenCLIArgs.COMPILE));
execution.setPhase(MavenCLIArgs.COMPILE);
Xpp3Dom compilerId = new Xpp3Dom(MavenConfig.MAVEN_COMPILER_ID);
compilerId.setValue(compiler.name().toLowerCase());
Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION);
configuration.addChild(compilerId);
execution.setConfiguration(configuration);
newCompilerPlugin.setExecutions(Arrays.asList(execution));
return newCompilerPlugin;
}
示例11: disableMavenCompilerAlreadyPresent
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
protected 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);
}
示例12: getVersionFixPlugin
import org.apache.maven.model.PluginExecution; //导入方法依赖的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;
}
示例13: testMerge_pluginFoundWithExecutions
import org.apache.maven.model.PluginExecution; //导入方法依赖的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));
}
示例14: testMerge_pluginFoundWithConflictingExecutions
import org.apache.maven.model.PluginExecution; //导入方法依赖的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));
}
示例15: clone
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private PluginExecution clone(PluginExecution execution) {
PluginExecution clonedExecution = new PluginExecution();
clonedExecution.setId(execution.getId() + "-snapshot");
clonedExecution.setGoals(execution.getGoals());
clonedExecution.setPhase(execution.getPhase());
clonedExecution.setPriority(execution.getPriority());
return clonedExecution;
}