本文整理汇总了Java中org.apache.maven.model.PluginExecution类的典型用法代码示例。如果您正苦于以下问题:Java PluginExecution类的具体用法?Java PluginExecution怎么用?Java PluginExecution使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PluginExecution类属于org.apache.maven.model包,在下文中一共展示了PluginExecution类的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: getPluginExecutions
import org.apache.maven.model.PluginExecution; //导入依赖的package包/类
/** @see org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator */
private static @NonNull List<PluginExecution> getPluginExecutions(@NonNull Plugin plug, @NullAllowed String goal) {
if (goal == null) {
return Collections.emptyList();
}
List<PluginExecution> exes = new ArrayList<PluginExecution>();
for (PluginExecution exe : plug.getExecutions()) {
if (exe.getGoals().contains(goal) || /* #179328: Maven 2.2.0+ */ ("default-" + goal).equals(exe.getId())) {
exes.add(exe);
}
}
Collections.sort(exes, new Comparator<PluginExecution>() {
@Override public int compare(PluginExecution e1, PluginExecution e2) {
return e2.getPriority() - e1.getPriority();
}
});
return exes;
}
示例3: 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;
}
示例4: 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));
}
示例5: testGetEnforcerPlugin
import org.apache.maven.model.PluginExecution; //导入依赖的package包/类
@Test
public void testGetEnforcerPlugin()
throws MavenExecutionException,
XmlPullParserException,
IOException {
Plugin result = item.getEnforcerPlugin();
Assert.assertEquals("GroupId", "org.apache.maven.plugins", result.getGroupId());
Assert.assertEquals("ArtifactId", "maven-enforcer-plugin", result.getArtifactId());
Assert.assertEquals("Version", "1.4.1", result.getVersion());
Assert.assertEquals("Executions.Size", 1, result.getExecutions().size());
PluginExecution execution = result.getExecutions().get(0);
Assert.assertEquals("Executions[0].Id", "no-snapshot-deps", execution.getId());
Assert.assertEquals("Executions[0].Goals.Size", 1, execution.getGoals().size());
Assert.assertEquals("Executions[0].Goals[0]", "enforce", execution.getGoals().get(0));
Assert.assertEquals("Executions[0].Configuration",
Xpp3DomBuilder.build(new StringReader("<configuration><rules><requireReleaseDeps><message>No Snapshots Allowed!</message></requireReleaseDeps></rules></configuration>")),
execution.getConfiguration());
}
示例6: testGetVersionFixPlugin
import org.apache.maven.model.PluginExecution; //导入依赖的package包/类
@Test
public void testGetVersionFixPlugin()
throws MavenExecutionException,
XmlPullParserException,
IOException {
Plugin result = item.getVersionFixPlugin();
Assert.assertEquals("GroupId", "com.iggroup.maven.cdversion", result.getGroupId());
Assert.assertEquals("ArtifactId", "versionfix-maven-plugin", result.getArtifactId());
Assert.assertEquals("Version", "1.0.0-SNAPSHOT", result.getVersion());
Assert.assertEquals("Executions.Size", 1, result.getExecutions().size());
PluginExecution execution = result.getExecutions().get(0);
Assert.assertEquals("Executions[0].Id", "versionfix", execution.getId());
Assert.assertEquals("Executions[0].Goals.Size", 1, execution.getGoals().size());
Assert.assertEquals("Executions[0].Goals[0]", "versionfix", execution.getGoals().get(0));
}
示例7: 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;
}
示例8: 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;
}
示例9: visitBuildPluginExecution
import org.apache.maven.model.PluginExecution; //导入依赖的package包/类
private void visitBuildPluginExecution( ModelVisitor visitor, PluginExecution pluginExecution )
{
List<String> goals = pluginExecution.getGoals();
if ( goals != null )
{
ListIterator<String> goalIterator = goals.listIterator();
while ( goalIterator.hasNext() )
{
String goal = goalIterator.next();
visitor.visitBuildPluginExecutionGoal( goal );
goal = visitor.replaceBuildPluginExecutionGoal( goal );
if ( goal == null )
goalIterator.remove();
else
goalIterator.set( goal );
}
}
}
示例10: visitBuildPluginManagementPluginExecution
import org.apache.maven.model.PluginExecution; //导入依赖的package包/类
private void visitBuildPluginManagementPluginExecution( ModelVisitor visitor, PluginExecution pluginExecution )
{
List<String> goals = pluginExecution.getGoals();
if ( goals != null )
{
ListIterator<String> goalIterator = goals.listIterator();
while ( goalIterator.hasNext() )
{
String goal = goalIterator.next();
visitor.visitBuildPluginManagementPluginExecutionGoal( goal );
goal = visitor.replaceBuildPluginManagementPluginExecutionGoal( goal );
if ( goal == null )
goalIterator.remove();
else
goalIterator.set( goal );
}
}
}
示例11: visitProfileBuildPluginExecution
import org.apache.maven.model.PluginExecution; //导入依赖的package包/类
private void visitProfileBuildPluginExecution( ModelVisitor visitor, PluginExecution pluginExecution )
{
List<String> goals = pluginExecution.getGoals();
if ( goals != null )
{
ListIterator<String> goalIterator = goals.listIterator();
while ( goalIterator.hasNext() )
{
String goal = goalIterator.next();
visitor.visitProfileBuildPluginExecutionGoal( goal );
goal = visitor.replaceProfileBuildPluginExecutionGoal( goal );
if ( goal == null )
goalIterator.remove();
else
goalIterator.set( goal );
}
}
}
示例12: visitProfileBuildPluginManagementPluginExecution
import org.apache.maven.model.PluginExecution; //导入依赖的package包/类
private void visitProfileBuildPluginManagementPluginExecution( ModelVisitor visitor,
PluginExecution pluginExecution )
{
List<String> goals = pluginExecution.getGoals();
if ( goals != null )
{
ListIterator<String> goalIterator = goals.listIterator();
while ( goalIterator.hasNext() )
{
String goal = goalIterator.next();
visitor.visitProfileBuildPluginManagementPluginExecutionGoal( goal );
goal = visitor.replaceProfileBuildPluginManagementPluginExecutionGoal( goal );
if ( goal == null )
goalIterator.remove();
else
goalIterator.set( goal );
}
}
}
示例13: getRuleConfigurations
import org.apache.maven.model.PluginExecution; //导入依赖的package包/类
/**
* Returns the list of <tt>requirePropertyDiverges</tt> configurations from the map of plugins.
*
* @param plugins
* @return list of requirePropertyDiverges configurations.
*/
List<Xpp3Dom> getRuleConfigurations( final Map<String, Plugin> plugins )
{
if ( plugins.containsKey( MAVEN_ENFORCER_PLUGIN ) )
{
final List<Xpp3Dom> ruleConfigurations = new ArrayList<Xpp3Dom>();
final Plugin enforcer = plugins.get( MAVEN_ENFORCER_PLUGIN );
final Xpp3Dom configuration = ( Xpp3Dom ) enforcer.getConfiguration();
// add rules from plugin configuration
addRules( configuration, ruleConfigurations );
// add rules from all plugin execution configurations
for ( Object execution : enforcer.getExecutions() )
{
addRules( ( Xpp3Dom ) ( ( PluginExecution ) execution ).getConfiguration(), ruleConfigurations );
}
return ruleConfigurations;
}
else
{
return new ArrayList();
}
}
示例14: testExecuteInParentWithConfigurationInExecution
import org.apache.maven.model.PluginExecution; //导入依赖的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 );
}
示例15: addMavenBpelPlugin
import org.apache.maven.model.PluginExecution; //导入依赖的package包/类
public static void addMavenBpelPlugin(MavenProject mavenProject){
Plugin plugin;
PluginExecution pluginExecution;
plugin = MavenUtils.createPluginEntry(mavenProject, GROUP_ID_ORG_WSO2_MAVEN, ARTIFACT_ID_MAVEN_BPEL_PLUGIN,
WSO2MavenPluginVersions.getPluginVersion(ARTIFACT_ID_MAVEN_BPEL_PLUGIN), true);
// FIXME : remove hard-coded version value (cannot use
// org.wso2.developerstudio.eclipse.capp.maven.utils.MavenConstants
// due to cyclic reference)
// pluginExecution=new PluginExecution();
// pluginExecution.addGoal("bpel");
// pluginExecution.setPhase("package");
// pluginExecution.setId("bpel");
// plugin.addExecution(pluginExecution)
mavenProject.getModel().addProperty(PROPERTY_CAPP_TYPE, "bpel/workflow");
}