org.sonatype.aether.version.Version.toString()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中org.sonatype.aether.version.Version.toString()方法的一些代码示例,展示了Version.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.toString()方法的具体详情如下:
包路径:org.sonatype.aether.version.Version
类名称:Version
方法名:toString

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() ) );

相关文章