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


Java PluginExecution.setGoals方法代码示例

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


在下文中一共展示了PluginExecution.setGoals方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: mergePluginExecution_Goals

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
@Override
protected void mergePluginExecution_Goals( PluginExecution target, PluginExecution source, boolean sourceDominant,
                                           Map<Object, Object> context )
{
    List<String> src = source.getGoals();
    if ( !src.isEmpty() )
    {
        List<String> tgt = target.getGoals();
        Set<String> excludes = new LinkedHashSet<String>( tgt );
        List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
        merged.addAll( tgt );
        for ( String s : src )
        {
            if ( !excludes.contains( s ) )
            {
                merged.add( s );
            }
        }
        target.setGoals( merged );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:22,代码来源:MavenModelMerger.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: 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

示例7: 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

示例8: 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

示例9: 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

示例10: mergePluginExecution_Goals

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
protected void mergePluginExecution_Goals( PluginExecution target, PluginExecution source, boolean sourceDominant,
                                           Map<Object, Object> context )
{
    List<String> src = source.getGoals();
    if ( !src.isEmpty() )
    {
        List<String> tgt = target.getGoals();
        List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
        merged.addAll( tgt );
        merged.addAll( src );
        target.setGoals( merged );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ModelMerger.java


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