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

x33g5p2x  于2022-01-16 转载在 其他  
字(10.2k)|赞(0)|评价(0)|浏览(119)

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

Build.getExtensions介绍

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

代码示例

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

public List getExtensions()
{
  return build.getExtensions();
}

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

public List getBuildExtensions()
{
  Build build = getBuild();
  if ( build == null || build.getExtensions() == null )
  {
    return Collections.EMPTY_LIST;
  }
  else
  {
    return build.getExtensions();
  }
}

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

/**
 * Method addExtension.
 * 
 * @param extension
 */
public void addExtension( Extension extension )
{
  getExtensions().add( extension );
} //-- void addExtension( Extension )

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

/**
 * Method removeExtension.
 * 
 * @param extension
 */
public void removeExtension( Extension extension )
{
  getExtensions().remove( extension );
} //-- void removeExtension( Extension )

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

public List<Extension> getBuildExtensions()
{
  Build build = getBuild();
  if ( ( build == null ) || ( build.getExtensions() == null ) )
  {
    return Collections.emptyList();
  }
  else
  {
    return Collections.unmodifiableList( build.getExtensions() );
  }
}

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

private static void mergeExtensionLists( Build childBuild, Build parentBuild )
  {
    for ( Extension e : parentBuild.getExtensions() )
    {
      if ( !childBuild.getExtensions().contains( e ) )
      {
        childBuild.addExtension( e );
      }
    }
  }
}

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

protected void mergeBuild_Extensions( Build target, Build source, boolean sourceDominant,
                   Map<Object, Object> context )
{
  List<Extension> src = source.getExtensions();
  if ( !src.isEmpty() )
  {
    List<Extension> tgt = target.getExtensions();
    Map<Object, Extension> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
    for ( Extension element : tgt )
    {
      Object key = getExtensionKey( element );
      merged.put( key, element );
    }
    for ( Extension element : src )
    {
      Object key = getExtensionKey( element );
      if ( sourceDominant || !merged.containsKey( key ) )
      {
        merged.put( key, element );
      }
    }
    target.setExtensions( new ArrayList<>( merged.values() ) );
  }
}

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

public static void mergeExtensionLists( Build childBuild, Build parentBuild )
{
  Map extMap = new LinkedHashMap();
  List ext = childBuild.getExtensions();
  if ( ext != null )
  {
    for ( Iterator it = ext.iterator(); it.hasNext(); )
    {
      Extension extension = (Extension) it.next();
      extMap.put( extension.getKey(), extension );
    }
  }
  ext = parentBuild.getExtensions();
  if ( ext != null )
  {
    for ( Iterator it = ext.iterator(); it.hasNext(); )
    {
      Extension extension = (Extension) it.next();
      if ( !extMap.containsKey( extension.getKey() ) )
      {
        extMap.put( extension.getKey(), extension );
      }
    }
  }
  childBuild.setExtensions( new ArrayList( extMap.values() ) );
}

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

private void mergeDeterministicBuildElements( Build interpolatedBuild,
                       Build dynamicBuild )
{
  mergeDeterministicPluginElements( interpolatedBuild.getPlugins(), dynamicBuild.getPlugins() );
  PluginManagement dPluginMgmt = dynamicBuild.getPluginManagement();
  PluginManagement iPluginMgmt = interpolatedBuild.getPluginManagement();
  if ( dPluginMgmt != null )
  {
    mergeDeterministicPluginElements( iPluginMgmt.getPlugins(), dPluginMgmt.getPlugins() );
  }
  if ( dynamicBuild.getExtensions() != null )
  {
    dynamicBuild.setExtensions( interpolatedBuild.getExtensions() );
  }
}

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

for ( Extension extension : build.getExtensions() )

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

public static Build cloneBuild( Build src )
{
  if ( src == null )
  {
    return null;
  }
  Build result = new Build();
  
  cloneBuildBaseFields( src, result );
  
  result.setExtensions( cloneList( src.getExtensions(), EXTENSION_CLONER ) );
  result.setOutputDirectory( src.getOutputDirectory() );
  
  result.setScriptSourceDirectory( src.getScriptSourceDirectory() );
  result.setSourceDirectory( src.getSourceDirectory() );
  result.setTestOutputDirectory( src.getTestOutputDirectory() );
  result.setTestSourceDirectory( src.getTestSourceDirectory() );
  
  return result;
}

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

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

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

out.write("            .testOutputDirectory(\"" + build.getTestOutputDirectory() + "\")" + br);
List<Extension> extensions = build.getExtensions(); 
if (extensions != null && !extensions.isEmpty()) {
  out.write("            .extensions(" + br);

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

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

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

/**
 * Method addExtension.
 * 
 * @param extension
 */
public void addExtension( Extension extension )
{
  getExtensions().add( extension );
} //-- void addExtension( Extension )

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

/**
 * Method removeExtension.
 * 
 * @param extension
 */
public void removeExtension( Extension extension )
{
  getExtensions().remove( extension );
} //-- void removeExtension( Extension )

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

protected void mergeBuild_Extensions( Build target, Build source, boolean sourceDominant,
                   Map<Object, Object> context )
{
  List<Extension> src = source.getExtensions();
  if ( !src.isEmpty() )
  {
    List<Extension> tgt = target.getExtensions();
    Map<Object, Extension> merged = new LinkedHashMap<Object, Extension>( ( src.size() + tgt.size() ) * 2 );
    for ( Extension element : tgt )
    {
      Object key = getExtensionKey( element );
      merged.put( key, element );
    }
    for ( Extension element : src )
    {
      Object key = getExtensionKey( element );
      if ( sourceDominant || !merged.containsKey( key ) )
      {
        merged.put( key, element );
      }
    }
    target.setExtensions( new ArrayList<Extension>( merged.values() ) );
  }
}

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

private List<Extension> createReleaseExtensions( ReleaseDescriptor releaseDescriptor,
                         MavenProject project )
  throws ReleaseFailureException
{
  List<Extension> releaseExtensions = null;
  // Use original - don't want the lifecycle introduced ones
  Build build = project.getOriginalModel().getBuild();
  if ( build != null )
  {
    List<Extension> extensions = build.getExtensions();
    if ( extensions != null )
    {
      releaseExtensions = new ArrayList<>();
      for ( Extension extension : extensions )
      {
        String id = ArtifactUtils.versionlessKey( extension.getGroupId(), extension.getArtifactId() );
        Artifact artifact = project.getExtensionArtifactMap().get( id );
        String version = getReleaseVersion( releaseDescriptor, artifact );
        Extension releaseExtension = new Extension();
        releaseExtension.setGroupId( extension.getGroupId() );
        releaseExtension.setArtifactId( extension.getArtifactId() );
        releaseExtension.setVersion( version );
        releaseExtensions.add( releaseExtension );
      }
    }
  }
  return releaseExtensions;
}

代码示例来源:origin: org.codehaus.mevenide/nb-mvn-embedder

/**
 * Method updateBuild
 * 
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateBuild(Build value, String xmlTag, Counter counter, Element element)
{
  boolean shouldExist = value != null;
  Element root = updateElement(counter, element, xmlTag, shouldExist);
  if (shouldExist) {
    Counter innerCount = new Counter(counter.getDepth() + 1);
    findAndReplaceSimpleElement(innerCount, root,  "sourceDirectory", value.getSourceDirectory(), null);
    findAndReplaceSimpleElement(innerCount, root,  "scriptSourceDirectory", value.getScriptSourceDirectory(), null);
    findAndReplaceSimpleElement(innerCount, root,  "testSourceDirectory", value.getTestSourceDirectory(), null);
    findAndReplaceSimpleElement(innerCount, root,  "outputDirectory", value.getOutputDirectory(), null);
    findAndReplaceSimpleElement(innerCount, root,  "testOutputDirectory", value.getTestOutputDirectory(), null);
    iterateExtension(innerCount, root, value.getExtensions(),"extensions","extension");
    findAndReplaceSimpleElement(innerCount, root,  "defaultGoal", value.getDefaultGoal(), null);
    iterateResource(innerCount, root, value.getResources(),"resources","resource");
    iterateResource(innerCount, root, value.getTestResources(),"testResources","testResource");
    findAndReplaceSimpleElement(innerCount, root,  "directory", value.getDirectory(), null);
    findAndReplaceSimpleElement(innerCount, root,  "finalName", value.getFinalName(), null);
    findAndReplaceSimpleLists(innerCount, root, value.getFilters(), "filters", "filter");
    updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root);
    iteratePlugin(innerCount, root, value.getPlugins(),"plugins","plugin");
  }
} //-- void updateBuild(Build, String, Counter, Element)

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-maven-embedder

/**
 * Method updateBuild.
 * 
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateBuild(Build value, String xmlTag, Counter counter, Element element)
{
  boolean shouldExist = value != null;
  Element root = updateElement(counter, element, xmlTag, shouldExist);
  if (shouldExist) {
    Counter innerCount = new Counter(counter.getDepth() + 1);
    findAndReplaceSimpleElement(innerCount, root,  "sourceDirectory", value.getSourceDirectory(), null);
    findAndReplaceSimpleElement(innerCount, root,  "scriptSourceDirectory", value.getScriptSourceDirectory(), null);
    findAndReplaceSimpleElement(innerCount, root,  "testSourceDirectory", value.getTestSourceDirectory(), null);
    findAndReplaceSimpleElement(innerCount, root,  "outputDirectory", value.getOutputDirectory(), null);
    findAndReplaceSimpleElement(innerCount, root,  "testOutputDirectory", value.getTestOutputDirectory(), null);
    iterateExtension(innerCount, root, value.getExtensions(),"extensions","extension");
    findAndReplaceSimpleElement(innerCount, root,  "defaultGoal", value.getDefaultGoal(), null);
    iterateResource(innerCount, root, value.getResources(),"resources","resource");
    iterateResource(innerCount, root, value.getTestResources(),"testResources","testResource");
    findAndReplaceSimpleElement(innerCount, root,  "directory", value.getDirectory(), null);
    findAndReplaceSimpleElement(innerCount, root,  "finalName", value.getFinalName(), null);
    findAndReplaceSimpleLists(innerCount, root, value.getFilters(), "filters", "filter");
    updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root);
    iteratePlugin(innerCount, root, value.getPlugins(),"plugins","plugin");
  }
} //-- void updateBuild(Build, String, Counter, Element)

相关文章