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

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

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

Plugin.getDependencies介绍

[英]Method getDependencies.
[中]方法getDependencies。

代码示例

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

public List<Dependency> getDependencies()
{
  return plugin.getDependencies();
}

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

/**
 * Method addDependency.
 * 
 * @param dependency
 */
public void addDependency( Dependency dependency )
{
  getDependencies().add( dependency );
} //-- void addDependency( Dependency )

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

/**
 * Method removeDependency.
 * 
 * @param dependency
 */
public void removeDependency( Dependency dependency )
{
  getDependencies().remove( dependency );
} //-- void removeDependency( Dependency )

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

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

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

public static boolean pluginEquals( Plugin a, Plugin b )
{
  return Objects.equals( a.getArtifactId(), b.getArtifactId() ) //
    && Objects.equals( a.getGroupId(), b.getGroupId() ) //
    && Objects.equals( a.getVersion(), b.getVersion() ) //
    && a.isExtensions() == b.isExtensions() //
    && dependenciesEquals( a.getDependencies(), b.getDependencies() );
}

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

public static int pluginHashCode( Plugin plugin )
{
  int hash = 17;
  hash = hash * 31 + Objects.hashCode( plugin.getGroupId() );
  hash = hash * 31 + Objects.hashCode( plugin.getArtifactId() );
  hash = hash * 31 + Objects.hashCode( plugin.getVersion() );
  hash = hash * 31 + ( plugin.isExtensions() ? 1 : 0 );
  for ( Dependency dependency : plugin.getDependencies() )
  {
    hash = hash * 31 + Objects.hashCode( dependency.getGroupId() );
    hash = hash * 31 + Objects.hashCode( dependency.getArtifactId() );
    hash = hash * 31 + Objects.hashCode( dependency.getVersion() );
    hash = hash * 31 + Objects.hashCode( dependency.getType() );
    hash = hash * 31 + Objects.hashCode( dependency.getClassifier() );
    hash = hash * 31 + Objects.hashCode( dependency.getScope() );
    for ( Exclusion exclusion : dependency.getExclusions() )
    {
      hash = hash * 31 + Objects.hashCode( exclusion.getGroupId() );
      hash = hash * 31 + Objects.hashCode( exclusion.getArtifactId() );
    }
  }
  return hash;
}

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

@Override
public void injectDefaultValues( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
{
  injectDependencyDefaults( model.getDependencies() );
  Build build = model.getBuild();
  if ( build != null )
  {
    for ( Plugin plugin : build.getPlugins() )
    {
      injectDependencyDefaults( plugin.getDependencies() );
    }
  }
}

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

modelPlugin.setDependencies( injectDependencies( profilePlugin.getDependencies(), modelPlugin.getDependencies() ) );

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

child.setDependencies( mergeDependencyList( child.getDependencies(), parent.getDependencies() ) );

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

private void validate20EffectivePluginDependencies( ModelProblemCollector problems, Plugin plugin,
                          ModelBuildingRequest request )
{
  List<Dependency> dependencies = plugin.getDependencies();
  if ( !dependencies.isEmpty() )
  {
    String prefix = "build.plugins.plugin[" + plugin.getKey() + "].dependencies.dependency.";
    Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
    for ( Dependency d : dependencies )
    {
      validateEffectiveDependency( problems, d, false, prefix, request );
      validateVersion( prefix + "version", problems, errOn30, Version.BASE, d.getVersion(),
               d.getManagementKey(), d );
      validateEnum( prefix + "scope", problems, errOn30, Version.BASE, d.getScope(), d.getManagementKey(), d,
             "compile", "runtime", "system" );
    }
  }
}

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

for ( Iterator k = plugin.getDependencies().iterator(); k.hasNext(); )

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

plugin.getArtifactId(), plugin.getVersion(), false, true );
for ( Dependency dependency : plugin.getDependencies() )

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

private void injectPluginDeclarationFromProject( Plugin plugin, MavenProject project )
{
  Plugin pluginInPom = findPlugin( plugin, project.getBuildPlugins() );
  if ( pluginInPom == null && project.getPluginManagement() != null )
  {
    pluginInPom = findPlugin( plugin, project.getPluginManagement().getPlugins() );
  }
  if ( pluginInPom != null )
  {
    if ( plugin.getVersion() == null )
    {
      plugin.setVersion( pluginInPom.getVersion() );
    }
    plugin.setDependencies( new ArrayList<>( pluginInPom.getDependencies() ) );
  }
}

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

child.setDependencies( mergeDependencyList( child.getDependencies(), parent.getDependencies() ) );

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

if ( ( plugin.getDependencies() != null ) && ( plugin.getDependencies().size() > 0 ) )
  for ( Iterator iter = plugin.getDependencies().iterator(); iter.hasNext(); )

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

private void writePlugin(Plugin plugin, String indent) throws IOException {
  StringBuilder sb = new StringBuilder();
  sb.append(plugin.getGroupId() + ":" + plugin.getArtifactId());
  if (plugin.getVersion() != null) {
    sb.append(":" + plugin.getVersion());
  }
  out.write(indent + "plugin(\"" + sb.toString() + "\")" + br);
  if (plugin.getExtensions() != null) {
    out.write(indent + "    .extensions(" + plugin.getExtensions() + ")" + br);
  }
  if (plugin.getInherited() != null) {
    out.write(indent + "    .inherited(" + plugin.getInherited() + ")" + br);
  }
  if (plugin.getDependencies() != null && !plugin.getDependencies().isEmpty()) {
    out.write(indent + "    " + ".dependencies(" + br);
    writePluginDependency(plugin.getDependencies(), indent);
    out.write(indent + "    " + ")" + br);
  }
  writeConfiguration((Xpp3Dom)plugin.getConfiguration(), indent);
  
  out.write(indent + ".endPlugin()" + br);
}

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

request.setRepositories( repositories );
request.setRoot( new org.eclipse.aether.graph.Dependency( pluginArtifact, null ) );
for ( Dependency dependency : plugin.getDependencies() )

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

( !plugin.getExecutions().isEmpty() || !plugin.getDependencies().isEmpty() ) ){
p.printStartBlock();
dependencies( plugin.getDependencies() );

相关文章