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


Java RepositorySystem.resolveArtifact方法代码示例

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


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

示例1: get

import org.eclipse.aether.RepositorySystem; //导入方法依赖的package包/类
public Path get(@NotNull String groupName, @NotNull String artifactName, @NotNull String version, @NotNull String artifactFileExtension) {
    Artifact artifact = new DefaultArtifact(groupName, artifactName, artifactFileExtension, version);

    RepositorySystem system = newRepositorySystem();
    RepositorySystemSession session = newRepositorySystemSession(system);

    ArtifactRequest request = new ArtifactRequest();
    request.setArtifact(artifact);
    request.setRepositories(repositories(system, session));

    try {
        ArtifactResult artifactResult = system.resolveArtifact(session, request);

        artifact = artifactResult.getArtifact();

        Log.info(artifact + " resolved to  " + artifact.getFile());

        return artifact.getFile().toPath();

    } catch (ArtifactResolutionException e) {
        throw new RuntimeException(format("Couldn't resolve a '%s' artifact for '%s:%s:%s'",
                artifactFileExtension, groupName, artifactName, version
        ), e);
    }
}
 
开发者ID:jan-molak,项目名称:jenkins-build-monitor-plugin,代码行数:26,代码来源:ArtifactTransporter.java

示例2: resolveArtifact

import org.eclipse.aether.RepositorySystem; //导入方法依赖的package包/类
public URL resolveArtifact(String gav) throws PlexusContainerException, ComponentLookupException,
        ArtifactResolutionException, MalformedURLException {

    RepositorySystem repositorySystem = newRepositorySystem();
    RepositorySystemSession session = newSession(repositorySystem);
    ArtifactRequest artifactRequest = new ArtifactRequest();
    for (RemoteRepository repository : repositories) {
        artifactRequest.addRepository(RepositoryUtils.applySessionSettingsToRepository(session, repository));
    }
    artifactRequest.setArtifact(new DefaultArtifact(gav));
    ArtifactResult artifactResult = repositorySystem.resolveArtifact(session, artifactRequest);
    return artifactResult.getArtifact().getFile().toURI().toURL();
}
 
开发者ID:igor-suhorukov,项目名称:mvn-classloader,代码行数:14,代码来源:ClassLoaderBuilder.java

示例3: resolveArtifact

import org.eclipse.aether.RepositorySystem; //导入方法依赖的package包/类
/**
 * resolve an artifact by searching it into repositories using Aether API
 *
 * @param artifactToFind
 * @return
 * @throws ArtifactResolutionException
 */
protected ArtifactResult resolveArtifact(Artifact artifactToFind) throws ArtifactResolutionException {
    RepositorySystem aetherRepoSystem = aetherConfigurer.newRepositorySystem();
    RepositorySystemSession aetherRepoSession = aetherConfigurer.newSession(aetherRepoSystem, this.mvnConsumerConfigurer.getLocalM2Repo());
    ArtifactRequest resolveArtifactRequest = new ArtifactRequest(artifactToFind, initRemoteRepositories(), null);
    ArtifactResult artifactResultFound = aetherRepoSystem.resolveArtifact(aetherRepoSession, resolveArtifactRequest);
    return artifactResultFound;
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:15,代码来源:MvnRepoDaoImpl.java

示例4: resolveArtifact

import org.eclipse.aether.RepositorySystem; //导入方法依赖的package包/类
static ArtifactResult resolveArtifact(RepositorySystem rs, MavenSession ms, String coords) throws ArtifactResolutionException {
    return rs.resolveArtifact(
        ms.getRepositorySession(),
        new ArtifactRequest(new DefaultArtifact(coords), 
            RepositoryUtils.toRepos(ms.getRequest().getRemoteRepositories()), 
            null));
}
 
开发者ID:ahgittin,项目名称:license-audit-maven-plugin,代码行数:8,代码来源:BetterAbstractMojoTestCaseTest.java

示例5: downloadArtifact

import org.eclipse.aether.RepositorySystem; //导入方法依赖的package包/类
private Artifact downloadArtifact(
    Artifact artifact,
    RemoteRepository repository,
    RepositorySystemSession session,
    RepositorySystem system)
    throws ArtifactResolutionException {
  ArtifactRequest artifactRequest = new ArtifactRequest();
  artifactRequest.setArtifact(artifact);
  artifactRequest.setRepositories(ImmutableList.of(repository));
  ArtifactResult artifactResult = system.resolveArtifact(session, artifactRequest);
  return artifactResult.getArtifact();
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:13,代码来源:MavenDownloader.java

示例6: resolveArtifact

import org.eclipse.aether.RepositorySystem; //导入方法依赖的package包/类
private ArtifactResult resolveArtifact(Artifact artifact) {
    Moment before = X_Time.now();
    RepositorySystem repoSystem = this.repoSystem.get();
    RepositorySystemSession session = this.session.get();
    try {
      final LocalArtifactRequest localRequest = new LocalArtifactRequest(artifact, remoteRepos(), null);
      final LocalArtifactResult result = session.getLocalRepositoryManager().find(session, localRequest);
      ArtifactRequest request = new ArtifactRequest(artifact, remoteRepos(), null);
      if (result.isAvailable()) {
        final ArtifactResult artifactResult = new ArtifactResult(request);
        final Artifact withFile = artifact.setFile(result.getFile());
        artifactResult.setArtifact(withFile);
        artifactResult.setRepository(result.getRepository());
        return artifactResult;
      }
      return repoSystem.resolveArtifact(session, request);
    } catch (ArtifactResolutionException e) {
      X_Log.log(getClass(), getLogLevel(), "Resolved? ", e.getResult().isResolved(), e.getResult().getExceptions());
      X_Log.log(getClass(), getLogLevel(), "Could not download " + artifact, e);
      throw X_Debug.rethrow(e);
    } finally {
      if (X_Log.loggable(LogLevel.DEBUG)) {
        X_Log.debug("Resolved: " + artifact.toString() + " in "
            + X_Time.difference(before));
      }
    }
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:28,代码来源:MvnServiceDefault.java

示例7: main

import org.eclipse.aether.RepositorySystem; //导入方法依赖的package包/类
public static void main(String[] args) throws ArtifactResolutionException {
	System.out.println("------------------------------------------------------------");
	System.out.println(RemotePluginRepository.class.getSimpleName());

	RepositorySystem system = newRepositorySystem();

	RepositorySystemSession session = newRepositorySystemSession(system);

	Artifact artifact = new DefaultArtifact("org.eclipse.aether:aether-util:1.0.0.v20140518");

	ArtifactRequest artifactRequest = new ArtifactRequest();
	artifactRequest.setArtifact(artifact);
	artifactRequest.setRepositories(newRepositories(system, session));

	ArtifactResult artifactResult = system.resolveArtifact(session, artifactRequest);

	artifact = artifactResult.getArtifact();

	System.out.println(artifact + " resolved to  " + artifact.getFile());
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:21,代码来源:RemotePluginRepository.java


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