當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。