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

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

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

Plugin.getExecutions介绍

[英]Method getExecutions.
[中]方法获取执行。

代码示例

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

/**
 * Method removeExecution.
 * 
 * @param pluginExecution
 */
public void removeExecution( PluginExecution pluginExecution )
{
  getExecutions().remove( pluginExecution );
} //-- void removeExecution( PluginExecution )

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

List parentExecutions = parent.getExecutions();
  for ( Iterator it = child.getExecutions().iterator(); it.hasNext(); )

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

/**
 * Method addExecution.
 * 
 * @param pluginExecution
 */
public void addExecution( PluginExecution pluginExecution )
{
  getExecutions().add( pluginExecution );
} //-- void addExecution( PluginExecution )

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

List<PluginExecution> parentExecutions = parent.getExecutions();
  for ( PluginExecution childExecution : child.getExecutions() )

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

private String getExecutionId( Plugin plugin, String goal )
{
  Set<String> existingIds = new HashSet<>();
  for ( PluginExecution execution : plugin.getExecutions() )
  {
    existingIds.add( execution.getId() );
  }
  String base = "default-" + goal;
  String id = base;
  for ( int index = 1; existingIds.contains( id ); index++ )
  {
    id = base + '-' + index;
  }
  return id;
}

代码示例来源:origin: simpligility/android-maven-plugin

private static Xpp3Dom getMojoConfiguration( Plugin plugin )
  {
    //
    // We need to look in the configuration element, and then look for configuration elements
    // within the executions.
    //
    Xpp3Dom configuration = ( Xpp3Dom ) plugin.getConfiguration();
    if ( configuration == null )
    {
      if ( !plugin.getExecutions().isEmpty() )
      {
        configuration = ( Xpp3Dom ) plugin.getExecutions().get( 0 ).getConfiguration();
      }
    }
    return 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

/**
 * @return a Map of executions field with <code>PluginExecution#getId()</code> as key
 * @see org.apache.maven.model.PluginExecution#getId()
 */
public java.util.Map<String, PluginExecution> getExecutionsAsMap()
{
  if ( executionMap == null )
  {
    executionMap = new java.util.LinkedHashMap<String, PluginExecution>();
    if ( getExecutions() != null )
    {
      for ( java.util.Iterator<PluginExecution> i = getExecutions().iterator(); i.hasNext(); )
      {
        PluginExecution exec = (PluginExecution) i.next();
        if ( executionMap.containsKey( exec.getId() ) )
        {
          throw new IllegalStateException( "You cannot have two plugin executions with the same (or missing) <id/> elements.\nOffending execution\n\nId: \'" + exec.getId() + "\'\nPlugin:\'" + getKey() + "\'\n\n" );
        }
        executionMap.put( exec.getId(), exec );
      }
    }
  }
  return executionMap;
}

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

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 );

代码示例来源: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

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 );

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

private void mergeDeterministicPluginElements( List iPlugins, List dPlugins )
{
  if ( dPlugins != null )
  {
    for ( int i = 0; i < dPlugins.size(); i++ )
    {
      Plugin dPlugin = (Plugin) dPlugins.get( i );
      Plugin iPlugin = (Plugin) iPlugins.get( i );
      dPlugin.setGroupId( iPlugin.getGroupId() );
      dPlugin.setArtifactId( iPlugin.getArtifactId() );
      dPlugin.setVersion( iPlugin.getVersion() );
      
      dPlugin.setDependencies( iPlugin.getDependencies() );
      
      List dExecutions = dPlugin.getExecutions();
      if ( dExecutions != null )
      {
        List iExecutions = iPlugin.getExecutions();
        
        for ( int j = 0; j < dExecutions.size(); j++ )
        {
          PluginExecution dExec = (PluginExecution) dExecutions.get( j );
          PluginExecution iExec = (PluginExecution) iExecutions.get( j );
          
          dExec.setId( iExec.getId() );
        }
      }
    }
  }
}

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

if ( element.isInherited() || !element.getExecutions().isEmpty() )

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

for ( PluginExecution execution : plugin.getExecutions() )

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

private void expand( List<Plugin> plugins )
{
  for ( Plugin plugin : plugins )
  {
    Xpp3Dom pluginConfiguration = (Xpp3Dom) plugin.getConfiguration();
    if ( pluginConfiguration != null )
    {
      for ( PluginExecution execution : plugin.getExecutions() )
      {
        Xpp3Dom executionConfiguration = (Xpp3Dom) execution.getConfiguration();
        executionConfiguration =
          Xpp3Dom.mergeXpp3Dom( executionConfiguration, new Xpp3Dom( pluginConfiguration ) );
        execution.setConfiguration( executionConfiguration );
      }
    }
  }
}

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

for ( PluginExecution exec : plugin.getExecutions() )

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

for ( PluginExecution execution : plugin.getExecutions() )

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

plugin.getExecutions().add( execution );

代码示例来源: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: apache/maven

@Override
public void configure( MavenProject project, MojoExecution mojoExecution, boolean allowPluginLevelConfig )
{
  String g = mojoExecution.getGroupId();
  String a = mojoExecution.getArtifactId();
  Plugin plugin = findPlugin( g, a, project.getBuildPlugins() );
  if ( plugin == null && project.getPluginManagement() != null )
  {
    plugin = findPlugin( g, a, project.getPluginManagement().getPlugins() );
  }
  if ( plugin != null )
  {
    PluginExecution pluginExecution =
      findPluginExecution( mojoExecution.getExecutionId(), plugin.getExecutions() );
    Xpp3Dom pomConfiguration = null;
    if ( pluginExecution != null )
    {
      pomConfiguration = (Xpp3Dom) pluginExecution.getConfiguration();
    }
    else if ( allowPluginLevelConfig )
    {
      pomConfiguration = (Xpp3Dom) plugin.getConfiguration();
    }
    Xpp3Dom mojoConfiguration = ( pomConfiguration != null ) ? new Xpp3Dom( pomConfiguration ) : null;
    mojoConfiguration = Xpp3Dom.mergeXpp3Dom( mojoExecution.getConfiguration(), mojoConfiguration );
    mojoExecution.setConfiguration( mojoConfiguration );
  }
}

相关文章