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


Java VersionRangeRequest.addRepository方法代码示例

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


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

示例1: determineNewestVersion

import org.eclipse.aether.resolution.VersionRangeRequest; //导入方法依赖的package包/类
private static String determineNewestVersion(RepositorySystem repoSystem, RepositorySystemSession repoSession, List<RemoteRepository>[] repos) throws MojoExecutionException {
  String version;VersionRangeRequest rangeRequest = new VersionRangeRequest();
  rangeRequest.setArtifact(new DefaultArtifact(SDK_GROUP_ID + ":" + SDK_ARTIFACT_ID + ":[0,)"));
  for(List<RemoteRepository> repoList : repos) {
    for(RemoteRepository repo : repoList) {
      rangeRequest.addRepository(repo);
    }
  }

  VersionRangeResult rangeResult;
  try {
    rangeResult = repoSystem.resolveVersionRange(repoSession, rangeRequest);
  } catch (VersionRangeResolutionException e) {
    throw new MojoExecutionException("Could not resolve latest version of the App Engine Java SDK", e);
  }

  List<Version> versions = rangeResult.getVersions();

  Collections.sort(versions);

  Version newest = Iterables.getLast(versions);

  version = newest.toString();
  return version;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-maven-plugin,代码行数:26,代码来源:SdkResolver.java

示例2: getAvailableVersions

import org.eclipse.aether.resolution.VersionRangeRequest; //导入方法依赖的package包/类
@Override
public List<String> getAvailableVersions(String artifactGroup, String artifactName, List<PluginRepository> remoteRepositories) {
    List<String> versions = new ArrayList<>();
    try {
        // TODO figure out how to force remote check
        VersionRangeRequest rangeRequest = new VersionRangeRequest();
        rangeRequest.setArtifact(new DefaultArtifact(artifactGroup, artifactName, "jar", "[0,)"));
        if (remoteRepositories != null) {
            for (PluginRepository pluginRepository : remoteRepositories) {
                rangeRequest.addRepository(
                        new RemoteRepository.Builder(pluginRepository.getName(), "default", pluginRepository.getUrl()).build());
            }
        }
        DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
        File tempDir = new File(System.getProperty("java.io.tmpdir"), "temp-local-repo");
        tempDir.mkdirs();
        LocalRepository localRepo = new LocalRepository(tempDir.getAbsolutePath());
        session.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager(session, localRepo));
        session.setTransferListener(new PluginTransferListener());
        session.setRepositoryListener(new PluginRepositoryListener());
        VersionRangeResult rangeResult = repositorySystem.resolveVersionRange(session, rangeRequest);
        if (rangeResult != null) {
            List<Version> versionList = rangeResult.getVersions();
            for (Version version : versionList) {
                versions.add(version.toString());
            }
        }
        FileUtils.deleteQuietly(tempDir);
    } catch (VersionRangeResolutionException e) {
        logger.error("", e);
    }
    return versions;
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:34,代码来源:PluginManager.java

示例3: determineNewestVersion

import org.eclipse.aether.resolution.VersionRangeRequest; //导入方法依赖的package包/类
private static String determineNewestVersion(RepositorySystem repoSystem,
    RepositorySystemSession repoSession, List<RemoteRepository>[] repos)
    throws MojoExecutionException {
  String version;
  VersionRangeRequest rangeRequest = new VersionRangeRequest();
  rangeRequest.setArtifact(new DefaultArtifact(SDK_GROUP_ID + ":" + SDK_ARTIFACT_ID + ":[0,)"));
  for (List<RemoteRepository> repoList : repos) {
    for (RemoteRepository repo : repoList) {
      rangeRequest.addRepository(repo);
    }
  }

  VersionRangeResult rangeResult;
  try {
    rangeResult = repoSystem.resolveVersionRange(repoSession, rangeRequest);
  } catch (VersionRangeResolutionException e) {
    throw new MojoExecutionException(
        "Could not resolve latest version of the App Engine Java SDK", e);
  }

  List<Version> versions = rangeResult.getVersions();

  Collections.sort(versions);

  Version newest = Iterables.getLast(versions);

  version = newest.toString();
  return version;
}
 
开发者ID:GoogleCloudPlatform,项目名称:gcloud-maven-plugin,代码行数:30,代码来源:SdkResolver.java


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