本文整理了Java中org.sonatype.aether.version.Version.toString()
方法的一些代码示例,展示了Version.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.toString()
方法的具体详情如下:
包路径:org.sonatype.aether.version.Version
类名称:Version
方法名:toString
[英]Gets the original string representation of the version.
[中]获取版本的原始字符串表示形式。
代码示例来源:origin: sonatype/sonatype-aether
private boolean isSnapshot( Version version )
{
return version != null && version.toString().endsWith( "SNAPSHOT" );
}
代码示例来源:origin: sonatype/sonatype-aether
public int compareTo( Version o )
{
return version.compareTo( o.toString());
}
代码示例来源:origin: org.apache.openejb/openejb-provisionning
public static String highestVersion(final String info, final String prefix, final String defaultVersion) {
final VersionRangeResult result = VersionResolver.versions(info, defaultVersion);
if (result == null) {
return defaultVersion;
}
final List<Version> versions = result.getVersions();
Collections.sort(versions); // Version impl comparable so we just need to call it :)
Version usedVersion = null;
for (Version current : versions) {
if (current.toString().startsWith(prefix)) {
usedVersion = current;
}
}
if (usedVersion != null) {
return usedVersion.toString();
}
return defaultVersion;
}
}
代码示例来源:origin: io.fabric8.fab/fab-core
protected void addVersions(Collection<String> versions, DependencyNode node, DependencyId dependencyId) {
DependencyId thatId = DependencyId.newInstance(node);
if (dependencyId.equals(thatId)) {
String version = node.getVersion().toString();
versions.add(version);
}
List<DependencyNode> children = node.getChildren();
for (DependencyNode child : children) {
addVersions(versions, child, dependencyId);
}
}
}
代码示例来源:origin: org.jboss.forge/maven-impl
@Override
public List<Coordinate> resolveVersions(DependencyQuery query)
{
VersionRangeResult r = getVersions(query);
List<Coordinate> result = new ArrayList<Coordinate>();
Predicate<Dependency> filter = query.getDependencyFilter();
for (Version v : r.getVersions())
{
CoordinateBuilder coord = CoordinateBuilder.create(query.getCoordinate()).setVersion(v.toString());
DependencyBuilder versionedDep = DependencyBuilder.create().setCoordinate(coord);
if (filter == null || filter.accept(versionedDep))
{
result.add(coord);
}
}
return result;
}
代码示例来源:origin: org.apache.openejb/openejb-provisionning
/**
* Tries to resolve versions = LATEST using an open range version query.
* If it succeeds, version of artifact is set to the highest available version.
*
* @param session to be used.
* @param artifact to be used
* @return an artifact with version set properly (highest if available)
* @throws org.sonatype.aether.resolution.VersionRangeResolutionException
* in case of resolver errors.
*/
private Artifact resolveLatestVersionRange(RepositorySystemSession session, Artifact artifact)
throws VersionRangeResolutionException {
if (artifact.getVersion().equals("LATEST")) {
artifact = artifact.setVersion(LATEST_VERSION_RANGE);
VersionRangeResult versionResult = m_repoSystem.resolveVersionRange(session, new VersionRangeRequest(artifact, m_remoteRepos, null));
if (versionResult != null) {
Version v = versionResult.getHighestVersion();
if (v != null) {
artifact = artifact.setVersion(v.toString());
} else {
throw new VersionRangeResolutionException(versionResult, "Not highest version found for " + artifact);
}
}
}
return artifact;
}
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-indexer-lucene-plugin
.gavToPath(new Gav(groupId, artifactId, version.toString()));
final String vDirectory = PathUtils.getParentPath(gavPath);
try {
代码示例来源:origin: sonatype/sonatype-aether
for ( Version version : versions )
Artifact originalArtifact = dependency.getArtifact().setVersion( version.toString() );
Dependency d = dependency.setArtifact( originalArtifact );
代码示例来源:origin: sonatype/sonatype-aether
root = root.setArtifact( root.getArtifact().setVersion( version.toString() ) );
内容来源于网络,如有侵权,请联系作者删除!