本文整理汇总了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;
}
示例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;
}
示例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;
}