{
List<Coordinate> versions = deps.resolveAvailableVersions(DependencyQueryBuilder.create(
dependency.getCoordinate()).setFilter(new NonSnapshotDependencyFilter()));
if (versions.isEmpty())
versions = deps.resolveAvailableVersions(DependencyQueryBuilder.create(
dependency.getCoordinate()));
if (!versions.isEmpty())
toInstall = DependencyBuilder.create(dependency).setVersion(
versions.get(versions.size() - 1).getVersion());