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

x33g5p2x  于2022-01-24 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(117)

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

Model.getLicenses介绍

[英]Method getLicenses.
[中]方法获取许可证。

代码示例

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

/**
 * Method addLicense.
 * 
 * @param license
 */
public void addLicense( License license )
{
  getLicenses().add( license );
} //-- void addLicense( License )

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

/**
 * Method removeLicense.
 * 
 * @param license
 */
public void removeLicense( License license )
{
  getLicenses().remove( license );
} //-- void removeLicense( License )

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

@Override
protected void mergeModel_Licenses( Model target, Model source, boolean sourceDominant,
                  Map<Object, Object> context )
{
  if ( target.getLicenses().isEmpty() )
  {
    target.setLicenses( new ArrayList<>( source.getLicenses() ) );
  }
}

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

public List getLicenses()
{
  return getModel().getLicenses();
}

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

public List<License> getLicenses()
{
  return getModel().getLicenses();
}

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

protected void mergeModel_Licenses( Model target, Model source, boolean sourceDominant,
                  Map<Object, Object> context )
{
  List<License> src = source.getLicenses();
  if ( !src.isEmpty() )
  {
    List<License> tgt = target.getLicenses();
    Map<Object, License> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
    for ( License element : tgt )
    {
      Object key = getLicenseKey( element );
      merged.put( key, element );
    }
    for ( License element : src )
    {
      Object key = getLicenseKey( element );
      if ( sourceDominant || !merged.containsKey( key ) )
      {
        merged.put( key, element );
      }
    }
    target.setLicenses( new ArrayList<>( merged.values() ) );
  }
}

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

List<License> licenses = model.getLicenses();
properties.put( "license.count", licenses.size() );
for ( int i = 0; i < licenses.size(); i++ )

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

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

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

if ( child.getLicenses().size() == 0 )
  child.setLicenses( parent.getLicenses() );

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

if ( child.getLicenses().size() == 0 )
  child.setLicenses( parent.getLicenses() );

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

result.setInceptionYear( src.getInceptionYear() );
result.setIssueManagement( cloneIssueManagement( src.getIssueManagement() ) );
result.setLicenses( cloneList( src.getLicenses(), LICENSE_CLONER ) );

代码示例来源:origin: mojohaus/flatten-maven-plugin

@Override
public List<License> get( Model model )
{
  return model.getLicenses();
}

代码示例来源:origin: com.buschmais.jqassistant.plugin/jqassistant.plugin.m2repo

@Override
public List<License> getLicenses() {
  return delegate.getLicenses();
}

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

/**
 * Method removeLicense.
 * 
 * @param license
 */
public void removeLicense( License license )
{
  getLicenses().remove( license );
} //-- void removeLicense( License )

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

/**
 * Method addLicense.
 * 
 * @param license
 */
public void addLicense( License license )
{
  getLicenses().add( license );
} //-- void addLicense( License )

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

/**
 * Method addLicense
 * 
 * @param license
 */
public void addLicense(License license)
{
  if ( !(license instanceof License) )
  {
    throw new ClassCastException( "Model.addLicenses(license) parameter must be instanceof " + License.class.getName() );
  }
  getLicenses().add( license );
} //-- void addLicense(License)

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

@Override
protected void mergeModel_Licenses( Model target, Model source, boolean sourceDominant,
                  Map<Object, Object> context )
{
  if ( target.getLicenses().isEmpty() )
  {
    target.setLicenses( new ArrayList<>( source.getLicenses() ) );
  }
}

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

/**
 * Method removeLicense
 * 
 * @param license
 */
public void removeLicense(License license)
{
  if ( !(license instanceof License) )
  {
    throw new ClassCastException( "Model.removeLicenses(license) parameter must be instanceof " + License.class.getName() );
  }
  getLicenses().remove( license );
} //-- void removeLicense(License)

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

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

代码示例来源:origin: stackoverflow.com

try {
  Reader reader = new FileReader(pomXmlFile);
  Model model;
  try {
    final MavenXpp3Reader xpp3Reader = new MavenXpp3Reader();
    model = xpp3Reader.read(reader);
  } finally {
    reader.close();
  }
  List<License> licenses = model.getLicenses();
} catch (XmlPullParserException ex) {
  ex.printStackTrace();
} catch (IOException ex) {
  ex.printStackTrace();
}

相关文章

Model类方法