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


Java MetadataResult类代码示例

本文整理汇总了Java中org.sonatype.aether.resolution.MetadataResult的典型用法代码示例。如果您正苦于以下问题:Java MetadataResult类的具体用法?Java MetadataResult怎么用?Java MetadataResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getMetadata

import org.sonatype.aether.resolution.MetadataResult; //导入依赖的package包/类
public static Metadata getMetadata(RepositorySystem system, RepositorySystemSession session, Artifact artifact)
{
	Metadata metadata = new DefaultMetadata(
			artifact.getGroupId(),
			artifact.getArtifactId(),
			artifact.getVersion(),
			artifact.getArtifactId() + "-" + artifact.getBaseVersion() + ".pom",
			Metadata.Nature.RELEASE_OR_SNAPSHOT);
	MetadataRequest request = new MetadataRequest(metadata, central(), null);
	MetadataResult result = system.resolveMetadata(session, Collections.singleton(request)).get(0);
	return result.getMetadata();
}
 
开发者ID:bnavetta,项目名称:tycho-gen,代码行数:13,代码来源:Maven.java

示例2: processResults

import org.sonatype.aether.resolution.MetadataResult; //导入依赖的package包/类
private PluginPrefixResult processResults( PluginPrefixRequest request, RequestTrace trace,
                                           List<MetadataResult> results, List<MetadataRequest> requests )
{
    for ( MetadataResult res : results )
    {
        org.sonatype.aether.metadata.Metadata metadata = res.getMetadata();

        if ( metadata != null )
        {
            ArtifactRepository repository = res.getRequest().getRepository();
            if ( repository == null )
            {
                repository = request.getRepositorySession().getLocalRepository();
            }

            PluginPrefixResult result =
                resolveFromRepository( request, trace, metadata.getGroupId(), metadata, repository );

            if ( result != null )
            {
                return result;
            }
        }

        if ( requests != null && !res.isUpdated() )
        {
            requests.add( res.getRequest() );
        }
    }

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

示例3: resolveFromRepository

import org.sonatype.aether.resolution.MetadataResult; //导入依赖的package包/类
private PluginPrefixResult resolveFromRepository( PluginPrefixRequest request )
{
    RequestTrace trace = DefaultRequestTrace.newChild( null, request );

    List<MetadataRequest> requests = new ArrayList<MetadataRequest>();

    for ( String pluginGroup : request.getPluginGroups() )
    {
        org.sonatype.aether.metadata.Metadata metadata =
            new DefaultMetadata( pluginGroup, "maven-metadata.xml", DefaultMetadata.Nature.RELEASE_OR_SNAPSHOT );

        requests.add( new MetadataRequest( metadata, null, REPOSITORY_CONTEXT ).setTrace( trace ) );

        for ( RemoteRepository repository : request.getRepositories() )
        {
            requests.add( new MetadataRequest( metadata, repository, REPOSITORY_CONTEXT ).setTrace( trace ) );
        }
    }

    // initial try, use locally cached metadata

    List<MetadataResult> results = repositorySystem.resolveMetadata( request.getRepositorySession(), requests );
    requests.clear();

    PluginPrefixResult result = processResults( request, trace, results, requests );

    if ( result != null )
    {
        return result;
    }

    // second try, refetch all (possibly outdated) metadata that wasn't updated in the first attempt

    if ( !request.getRepositorySession().isOffline() && !requests.isEmpty() )
    {
        DefaultRepositorySystemSession session =
            new DefaultRepositorySystemSession( request.getRepositorySession() );
        session.setUpdatePolicy( RepositoryPolicy.UPDATE_POLICY_ALWAYS );

        results = repositorySystem.resolveMetadata( session, requests );

        return processResults( request, trace, results, null );
    }

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


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