org.apache.maven.model.Plugin.setExecutions()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中org.apache.maven.model.Plugin.setExecutions()方法的一些代码示例,展示了Plugin.setExecutions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.setExecutions()方法的具体详情如下:
包路径:org.apache.maven.model.Plugin
类名称:Plugin
方法名:setExecutions

Plugin.setExecutions介绍

[英]Set multiple specifications of a set of goals to execute during the build lifecycle, each having (possibly) a different configuration.
[中]为构建生命周期中要执行的一组目标设置多个规范,每个规范(可能)具有不同的配置。

代码示例

代码示例来源:origin: apache/maven

protected void mergePlugin_Executions( Plugin target, Plugin source, boolean sourceDominant,
                    Map<Object, Object> context )
{
  List<PluginExecution> src = source.getExecutions();
  if ( !src.isEmpty() )
  {
    List<PluginExecution> tgt = target.getExecutions();
    Map<Object, PluginExecution> merged =
      new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
    for ( PluginExecution element : tgt )
    {
      Object key = getPluginExecutionKey( element );
      merged.put( key, element );
    }
    for ( PluginExecution element : src )
    {
      Object key = getPluginExecutionKey( element );
      if ( sourceDominant || !merged.containsKey( key ) )
      {
        merged.put( key, element );
      }
    }
    target.setExecutions( new ArrayList<>( merged.values() ) );
  }
}

代码示例来源:origin: apache/maven

target.setExecutions( new ArrayList<>( merged.values() ) );

代码示例来源:origin: apache/maven

@Override
  protected void mergePlugin_Executions( Plugin target, Plugin source, boolean sourceDominant,
                      Map<Object, Object> context )
  {
    List<PluginExecution> src = source.getExecutions();
    if ( !src.isEmpty() )
    {
      List<PluginExecution> tgt = target.getExecutions();
      Map<Object, PluginExecution> merged =
        new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
      for ( PluginExecution element : src )
      {
        Object key = getPluginExecutionKey( element );
        merged.put( key, element.clone() );
      }
      for ( PluginExecution element : tgt )
      {
        Object key = getPluginExecutionKey( element );
        PluginExecution existing = merged.get( key );
        if ( existing != null )
        {
          mergePluginExecution( element, existing, sourceDominant, context );
        }
        merged.put( key, element );
      }
      target.setExecutions( new ArrayList<>( merged.values() ) );
    }
  }
}

代码示例来源:origin: apache/maven

target.setExecutions( new ArrayList<>( merged.values() ) );

代码示例来源:origin: org.apache.maven/maven-project

modelPlugin.setExecutions( profilePlugin.getExecutions() );
modelPlugin.setExecutions( new ArrayList( executions.values() ) );

代码示例来源:origin: org.apache.maven/maven-project

child.setExecutions(mergedExecutions);

代码示例来源:origin: apache/maven

child.setExecutions( mergedExecutions );

代码示例来源:origin: apache/maven

plugin.setExecutions( executions );
while ( parser.nextTag() == XmlPullParser.START_TAG )

代码示例来源:origin: org.apache.maven/maven-project

public static Plugin clonePlugin( Plugin src )
{
  Plugin result = null;
  if ( src != null )
  {
    result = new Plugin();
    result.setArtifactId( src.getArtifactId() );
    
    result.setConfiguration( cloneConfiguration( src.getConfiguration() ) );
    
    result.setDependencies( cloneList( src.getDependencies(), DEPENDENCY_CLONER ) );
    result.setExecutions( cloneList( src.getExecutions(), PLUGIN_EXECUTION_CLONER ) );
    
    result.setExtensions( src.isExtensions() );
    result.setGroupId( src.getGroupId() );
    result.setInherited( src.getInherited() );
    result.setVersion( src.getVersion() );
  }
  
  return result;
}

代码示例来源:origin: takari/polyglot-maven

public PluginBuilder executions(PluginExecutionBuilder... builders) {
  if (builders != null) {
    for (PluginExecutionBuilder executionBuilder : Arrays.asList(builders)) {
      if (plugin.getExecutions() == null) {	
        plugin.setExecutions(new ArrayList<>());
      }
      plugin.addExecution((executionBuilder.get()));
    }
  }
  return this;
}

代码示例来源:origin: apache/maven

plugin.setExecutions( executions );
while ( parser.nextTag() == XmlPullParser.START_TAG )

代码示例来源:origin: takari/polyglot-maven

public default WrapperPluginBuilder plugin(PluginNamedValue... namedValues) {
  Plugin plugin = new Plugin();
  
  Map<String, String> map = new HashMap<>();
  for (PluginNamedValue kvp : namedValues) {
    if (kvp instanceof ConfigurationNamedValue) {
      plugin.setConfiguration(((ConfigurationNamedValue)kvp).getConfiguration());
    } else if (kvp instanceof ExecutionsNamedValue) {
      plugin.setExecutions(((ExecutionsNamedValue)kvp).getExecutions());
    } else if (kvp instanceof DependenciesNamedValue) {
      plugin.setDependencies(((DependenciesNamedValue)kvp).getDependencies());
    } else {
      map.put(kvp.name(), kvp.value());    
      NamedValueProcessor.mapToObject(plugin, map);
    }                
  }
  
  return new WrapperPluginBuilder(plugin);
}

代码示例来源:origin: lewisd32/lint-maven-plugin

public void setExecutions(List<PluginExecution> executions) {
  plugin.setExecutions(executions);
}

代码示例来源:origin: takari/polyglot-maven

plugin.setExecutions( executions );
while ( parser.nextTag() == XmlPullParser.START_TAG )

代码示例来源:origin: io.tesla.maven/maven-model

protected void mergePlugin_Executions( Plugin target, Plugin source, boolean sourceDominant,
                    Map<Object, Object> context )
{
  List<PluginExecution> src = source.getExecutions();
  if ( !src.isEmpty() )
  {
    List<PluginExecution> tgt = target.getExecutions();
    Map<Object, PluginExecution> merged =
      new LinkedHashMap<Object, PluginExecution>( ( src.size() + tgt.size() ) * 2 );
    for ( PluginExecution element : tgt )
    {
      Object key = getPluginExecutionKey( element );
      merged.put( key, element );
    }
    for ( PluginExecution element : src )
    {
      Object key = getPluginExecutionKey( element );
      if ( sourceDominant || !merged.containsKey( key ) )
      {
        merged.put( key, element );
      }
    }
    target.setExecutions( new ArrayList<PluginExecution>( merged.values() ) );
  }
}

代码示例来源:origin: org.apache.maven/maven-model-builder

target.setExecutions( new ArrayList<>( merged.values() ) );

代码示例来源:origin: org.apache.maven/maven-model-builder

@Override
  protected void mergePlugin_Executions( Plugin target, Plugin source, boolean sourceDominant,
                      Map<Object, Object> context )
  {
    List<PluginExecution> src = source.getExecutions();
    if ( !src.isEmpty() )
    {
      List<PluginExecution> tgt = target.getExecutions();
      Map<Object, PluginExecution> merged =
        new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
      for ( PluginExecution element : src )
      {
        Object key = getPluginExecutionKey( element );
        merged.put( key, element.clone() );
      }
      for ( PluginExecution element : tgt )
      {
        Object key = getPluginExecutionKey( element );
        PluginExecution existing = merged.get( key );
        if ( existing != null )
        {
          mergePluginExecution( element, existing, sourceDominant, context );
        }
        merged.put( key, element );
      }
      target.setExecutions( new ArrayList<>( merged.values() ) );
    }
  }
}

代码示例来源:origin: org.apache.maven/maven-model-builder

target.setExecutions( new ArrayList<>( merged.values() ) );

代码示例来源:origin: org.kie.workbench.services/kie-wb-common-compiler-core

public static Plugin getNewCompilerPlugin(Map<ConfigurationKey, String> conf) {
  Plugin newCompilerPlugin = new Plugin();
  newCompilerPlugin.setGroupId(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_GROUP));
  newCompilerPlugin.setArtifactId(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_ARTIFACT));
  newCompilerPlugin.setVersion(conf.get(ConfigurationKey.TAKARI_COMPILER_PLUGIN_VERSION));
  Xpp3Dom compilerId = new Xpp3Dom(MavenConfig.MAVEN_COMPILER_ID);
  compilerId.setValue(conf.get(ConfigurationKey.COMPILER));
  Xpp3Dom sourceVersion = new Xpp3Dom(MavenConfig.MAVEN_SOURCE);
  sourceVersion.setValue(conf.get(ConfigurationKey.SOURCE_VERSION));
  Xpp3Dom targetVersion = new Xpp3Dom(MavenConfig.MAVEN_TARGET);
  targetVersion.setValue(conf.get(ConfigurationKey.TARGET_VERSION));
  Xpp3Dom failOnError = new Xpp3Dom(MavenConfig.FAIL_ON_ERROR);
  failOnError.setValue(conf.get(ConfigurationKey.FAIL_ON_ERROR));
  Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION);
  configuration.addChild(compilerId);
  configuration.addChild(sourceVersion);
  configuration.addChild(targetVersion);
  configuration.addChild(failOnError);
  newCompilerPlugin.setConfiguration(configuration);
  PluginExecution execution = new PluginExecution();
  execution.setId(MavenCLIArgs.DEFAULT_COMPILE);
  execution.setGoals(Arrays.asList(MavenCLIArgs.COMPILE));
  execution.setPhase(MavenCLIArgs.COMPILE);
  newCompilerPlugin.setExecutions(Arrays.asList(execution));
  return newCompilerPlugin;
}

代码示例来源:origin: org.kie.workbench.services/kie-wb-common-compiler-core

public static 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);
  }
}

相关文章