当前位置: 首页>>代码示例>>Java>>正文


Java Metadata.getPlugins方法代码示例

本文整理汇总了Java中org.apache.maven.artifact.repository.metadata.Metadata.getPlugins方法的典型用法代码示例。如果您正苦于以下问题:Java Metadata.getPlugins方法的具体用法?Java Metadata.getPlugins怎么用?Java Metadata.getPlugins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.artifact.repository.metadata.Metadata的用法示例。


在下文中一共展示了Metadata.getPlugins方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mergePlugins

import org.apache.maven.artifact.repository.metadata.Metadata; //导入方法依赖的package包/类
/**
 * Merges "right" plugins into "left", the instances are mutated.
 */
private void mergePlugins(final Metadata left, final Metadata right) {
  nullElementFilter(left.getPlugins());
  nullElementFilter(right.getPlugins());
  for (Plugin plugin : right.getPlugins()) {
    boolean found = false;
    for (Plugin preExisting : left.getPlugins()) {
      if (Objects.equals(preExisting.getArtifactId(), plugin.getArtifactId())
          && Objects.equals(preExisting.getPrefix(), plugin.getPrefix())) {
        found = true;
        preExisting.setName(plugin.getName());
        break;
      }
    }
    if (!found) {
      Plugin newPlugin = new Plugin();
      newPlugin.setArtifactId(plugin.getArtifactId());
      newPlugin.setPrefix(plugin.getPrefix());
      newPlugin.setName(plugin.getName());
      left.addPlugin(newPlugin);
    }
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:26,代码来源:RepositoryMetadataMerger.java

示例2: getMetadataLastModified

import org.apache.maven.artifact.repository.metadata.Metadata; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public long getMetadataLastModified( String path )
    throws IOException, MetadataNotFoundException
{
    Metadata metadata = getMetadata( path );
    if ( metadata != null )
    {
        if ( !StringUtils.isEmpty( metadata.getGroupId() ) || !StringUtils.isEmpty( metadata.getArtifactId() )
            || !StringUtils.isEmpty( metadata.getVersion() )
            || ( metadata.getPlugins() != null && !metadata.getPlugins().isEmpty() ) || (
            metadata.getVersioning() != null && ( !StringUtils.isEmpty( metadata.getVersioning().getLastUpdated() )
                || !StringUtils.isEmpty( metadata.getVersioning().getLatest() )
                || !StringUtils.isEmpty( metadata.getVersioning().getRelease() )
                || ( metadata.getVersioning().getVersions() != null
                && !metadata.getVersioning().getVersions().isEmpty() ) || ( metadata.getVersioning().getSnapshot()
                != null ) ) ) )
        {
            return System.currentTimeMillis();
        }
    }
    throw new MetadataNotFoundException( path );
}
 
开发者ID:mojohaus,项目名称:mrm,代码行数:25,代码来源:ProxyArtifactStore.java

示例3: modified

import org.apache.maven.artifact.repository.metadata.Metadata; //导入方法依赖的package包/类
/**
 * Minimal checks for modified metadata.
 *
 * @param originalMetadata from
 * @param newMetadata      to
 * @return true if modified false if identical
 */
private boolean modified(Metadata originalMetadata, Metadata newMetadata) {
    if (originalMetadata == null) {
        return true;
    }

    List originalPlugins = originalMetadata.getPlugins();
    if (originalPlugins.size() != newMetadata.getPlugins().size()) {
        return true;
    }

    for (Object pluginObj : newMetadata.getPlugins()) {
        if (!hasPlugin(originalMetadata, ((Plugin) pluginObj).getArtifactId())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:25,代码来源:MavenPluginsMetadataCalculator.java

示例4: hasPlugin

import org.apache.maven.artifact.repository.metadata.Metadata; //导入方法依赖的package包/类
/**
 * @param metadata   the plugin pom metadata
 * @param artifactId the plugin id to find
 * @return true if the input plugin is listed in the metadata plugins
 */
private boolean hasPlugin(Metadata metadata, String artifactId) {
    for (Object pluginObj : metadata.getPlugins()) {
        if (((Plugin) pluginObj).getArtifactId().equals(artifactId)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:14,代码来源:MavenPluginsMetadataCalculator.java

示例5: resolveFromRepository

import org.apache.maven.artifact.repository.metadata.Metadata; //导入方法依赖的package包/类
private PluginPrefixResult resolveFromRepository( PluginPrefixRequest request, RequestTrace trace,
                                                  String pluginGroup,
                                                  org.sonatype.aether.metadata.Metadata metadata,
                                                  ArtifactRepository repository )
{
    if ( metadata != null && metadata.getFile() != null && metadata.getFile().isFile() )
    {
        try
        {
            Map<String, ?> options = Collections.singletonMap( MetadataReader.IS_STRICT, Boolean.FALSE );

            Metadata pluginGroupMetadata = metadataReader.read( metadata.getFile(), options );

            List<org.apache.maven.artifact.repository.metadata.Plugin> plugins = pluginGroupMetadata.getPlugins();

            if ( plugins != null )
            {
                for ( org.apache.maven.artifact.repository.metadata.Plugin plugin : plugins )
                {
                    if ( request.getPrefix().equals( plugin.getPrefix() ) )
                    {
                        return new DefaultPluginPrefixResult( pluginGroup, plugin.getArtifactId(), repository );
                    }
                }
            }
        }
        catch ( IOException e )
        {
            invalidMetadata( request.getRepositorySession(), trace, metadata, repository, e );
        }
    }

    return null;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:35,代码来源:DefaultPluginPrefixResolver.java


注:本文中的org.apache.maven.artifact.repository.metadata.Metadata.getPlugins方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。