本文整理汇总了Java中org.apache.maven.model.PluginExecution.addGoal方法的典型用法代码示例。如果您正苦于以下问题:Java PluginExecution.addGoal方法的具体用法?Java PluginExecution.addGoal怎么用?Java PluginExecution.addGoal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.PluginExecution
的用法示例。
在下文中一共展示了PluginExecution.addGoal方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例4: 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;
}
示例5: testShouldNotMergePluginExecutionWhenExecInheritedIsFalseAndTreatAsInheritanceIsTrue
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
public void testShouldNotMergePluginExecutionWhenExecInheritedIsFalseAndTreatAsInheritanceIsTrue()
{
String gid = "group";
String aid = "artifact";
String ver = "1";
PluginContainer parent = new PluginContainer();
Plugin pParent = createPlugin( gid, aid, ver, Collections.EMPTY_MAP );
pParent.setInherited( Boolean.toString( true ) );
PluginExecution eParent = new PluginExecution();
String testId = "test";
eParent.setId( testId );
eParent.addGoal( "run" );
eParent.setPhase( "initialize" );
eParent.setInherited( Boolean.toString( false ) );
pParent.addExecution( eParent );
parent.addPlugin( pParent );
PluginContainer child = new PluginContainer();
Plugin pChild = createPlugin( gid, aid, ver, Collections.EMPTY_MAP );
PluginExecution eChild = new PluginExecution();
eChild.setId( "child-specified" );
eChild.addGoal( "child" );
eChild.setPhase( "compile" );
pChild.addExecution( eChild );
child.addPlugin( pChild );
ModelUtils.mergePluginDefinitions( pChild, pParent, true );
Map executionMap = pChild.getExecutionsAsMap();
assertNull( "test execution should not be inherited from parent.", executionMap.get( testId ) );
}
示例6: testShouldNotMergePluginExecutionWhenPluginInheritedIsFalseAndTreatAsInheritanceIsTrue
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
public void testShouldNotMergePluginExecutionWhenPluginInheritedIsFalseAndTreatAsInheritanceIsTrue()
{
String gid = "group";
String aid = "artifact";
String ver = "1";
PluginContainer parent = new PluginContainer();
Plugin pParent = createPlugin( gid, aid, ver, Collections.EMPTY_MAP );
pParent.setInherited( Boolean.toString( false ) );
PluginExecution eParent = new PluginExecution();
String testId = "test";
eParent.setId( testId );
eParent.addGoal( "run" );
eParent.setPhase( "initialize" );
eParent.setInherited( Boolean.toString( true ) );
pParent.addExecution( eParent );
parent.addPlugin( pParent );
PluginContainer child = new PluginContainer();
Plugin pChild = createPlugin( gid, aid, ver, Collections.EMPTY_MAP );
PluginExecution eChild = new PluginExecution();
eChild.setId( "child-specified" );
eChild.addGoal( "child" );
eChild.setPhase( "compile" );
pChild.addExecution( eChild );
child.addPlugin( pChild );
ModelUtils.mergePluginDefinitions( pChild, pParent, true );
Map executionMap = pChild.getExecutionsAsMap();
assertNull( "test execution should not be inherited from parent.", executionMap.get( testId ) );
}
示例7: testShouldMergePluginExecutionWhenExecInheritedIsTrueAndTreatAsInheritanceIsTrue
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
public void testShouldMergePluginExecutionWhenExecInheritedIsTrueAndTreatAsInheritanceIsTrue()
{
String gid = "group";
String aid = "artifact";
String ver = "1";
PluginContainer parent = new PluginContainer();
Plugin pParent = createPlugin( gid, aid, ver, Collections.EMPTY_MAP );
pParent.setInherited( Boolean.toString( true ) );
PluginExecution eParent = new PluginExecution();
String testId = "test";
eParent.setId( testId );
eParent.addGoal( "run" );
eParent.setPhase( "initialize" );
eParent.setInherited( Boolean.toString( true ) );
pParent.addExecution( eParent );
parent.addPlugin( pParent );
PluginContainer child = new PluginContainer();
Plugin pChild = createPlugin( gid, aid, ver, Collections.EMPTY_MAP );
PluginExecution eChild = new PluginExecution();
eChild.setId( "child-specified" );
eChild.addGoal( "child" );
eChild.setPhase( "compile" );
pChild.addExecution( eChild );
child.addPlugin( pChild );
ModelUtils.mergePluginDefinitions( pChild, pParent, true );
Map executionMap = pChild.getExecutionsAsMap();
assertNotNull( "test execution should be inherited from parent.", executionMap.get( testId ) );
}
示例8: addPluginExecution
import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private void addPluginExecution(Plugin plugin, String goal, Phase phase) {
PluginExecution pluginExecution = new PluginExecution();
pluginExecution.addGoal(goal);
pluginExecution.setPhase(phase.toString());
plugin.addExecution(pluginExecution);
}