本文整理汇总了Java中org.sonatype.aether.version.Version类的典型用法代码示例。如果您正苦于以下问题:Java Version类的具体用法?Java Version怎么用?Java Version使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Version类属于org.sonatype.aether.version包,在下文中一共展示了Version类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: latestVersion
import org.sonatype.aether.version.Version; //导入依赖的package包/类
private String latestVersion(final String groupId, final String artifactId)
throws MojoExecutionException
{
final VersionRangeRequest request = new VersionRangeRequest();
final Artifact artifact =
new DefaultArtifact(groupId, artifactId, null, "[0,)");
request.setArtifact(artifact);
makeImageJRepositoryKnown();
final List<RemoteRepository> repositories =
new ArrayList<RemoteRepository>();
repositories.addAll(remoteRepositories);
request.setRepositories(repositories);
VersionRangeResult result;
try {
result =
repositorySystem.resolveVersionRange(repositorySystemSession, request);
final List<Version> list = result.getVersions();
for (int i = list.size() - 1; i >= 0; i--) {
final String version = list.get(i).toString();
if (version.endsWith("-SNAPSHOT")) continue;
return version;
}
getLog().warn(
"Found no candidates for " + groupId + ":" + artifactId + "; Skipping");
return null;
}
catch (final VersionRangeResolutionException e) {
throw new MojoExecutionException("Could not resolve version for " +
groupId + ":" + artifactId, e);
}
}
示例2: getVersion
import org.sonatype.aether.version.Version; //导入依赖的package包/类
public Version getVersion(DependencyNode node)
{
return nodeFor(node).version;
}