当前位置: 首页>>代码示例>>Java>>正文


Java PluginExecution.setPhase方法代码示例

本文整理汇总了Java中org.apache.maven.model.PluginExecution.setPhase方法的典型用法代码示例。如果您正苦于以下问题:Java PluginExecution.setPhase方法的具体用法?Java PluginExecution.setPhase怎么用?Java PluginExecution.setPhase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.model.PluginExecution的用法示例。


在下文中一共展示了PluginExecution.setPhase方法的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;
}
 
开发者ID:commsen,项目名称:EM,代码行数:21,代码来源:DynamicMavenPlugin.java

示例2: 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));
}
 
开发者ID:IG-Group,项目名称:cdversion-maven-extension,代码行数:27,代码来源:PluginMergerTest.java

示例3: 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;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-maven-plugin,代码行数:25,代码来源:MavenModelUtils.java

示例4: 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;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-maven-plugin,代码行数:18,代码来源:MavenModelUtils.java

示例5: 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;
    }
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:23,代码来源:DefaultPomEditor.java

示例6: 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);
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:20,代码来源:DefaultPomEditor.java

示例7: 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));
}
 
开发者ID:IG-Group,项目名称:cdversion-maven-extension,代码行数:40,代码来源:PluginMergerTest.java

示例8: 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));
}
 
开发者ID:IG-Group,项目名称:cdversion-maven-extension,代码行数:39,代码来源:PluginMergerTest.java

示例9: 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;
}
 
开发者ID:rvs-fluid-it,项目名称:mvn-fluid-cd,代码行数:9,代码来源:FreezeExtension.java

示例10: mergePluginExecutionDefinitions

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private static void mergePluginExecutionDefinitions( PluginExecution child, PluginExecution parent )
{
    if ( child.getPhase() == null )
    {
        child.setPhase( parent.getPhase() );
    }

    List<String> parentGoals = parent.getGoals();
    List<String> childGoals = child.getGoals();

    List<String> goals = new ArrayList<String>();

    if ( ( childGoals != null ) && !childGoals.isEmpty() )
    {
        goals.addAll( childGoals );
    }

    if ( parentGoals != null )
    {
        for (  String goal : parentGoals )
        {
            if ( !goals.contains( goal ) )
            {
                goals.add( goal );
            }
        }
    }

    child.setGoals( goals );

    Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration();
    Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration();

    childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration );

    child.setConfiguration( childConfiguration );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:38,代码来源:ModelUtils.java

示例11: 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 ) );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:40,代码来源:ModelUtilsTest.java

示例12: 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 ) );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:40,代码来源:ModelUtilsTest.java

示例13: 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 ) );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:40,代码来源:ModelUtilsTest.java

示例14: mergePluginExecution_Phase

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
protected void mergePluginExecution_Phase( PluginExecution target, PluginExecution source, boolean sourceDominant,
                                           Map<Object, Object> context )
{
    String src = source.getPhase();
    if ( src != null )
    {
        if ( sourceDominant || target.getPhase() == null )
        {
            target.setPhase( src );
            target.setLocation( "phase", source.getLocation( "phase" ) );
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ModelMerger.java

示例15: 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);
}
 
开发者ID:javabuild,项目名称:builder-parent,代码行数:7,代码来源:MavenBuilderExtension.java


注:本文中的org.apache.maven.model.PluginExecution.setPhase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。