private Artifact getLatestVersion0(String coords) {
try {
final Artifact artifact = coordsToArtifact(coords, "jar");
final VersionRangeRequest versionRangeRequest = new VersionRangeRequest().setRepositories(repos).setArtifact(artifact);
final VersionRangeResult versionRangeResult = system.resolveVersionRange(session, versionRangeRequest);
final Version highestVersion = versionRangeResult.getHighestVersion();
if (highestVersion == null)
throw new RuntimeException("Could not find any version of artifact " + coords + " (looking for: " + artifact + ")");
return artifact.setVersion(highestVersion.toString());
} catch (VersionRangeResolutionException e) {
throw new RuntimeException(e);
}
}