Is there a way to aks a Ivy repo for the lates revision number of an artifact?

Hi,
in the Ivy library there is an Ant tasks called findrevision:
“Finds the latest revision of a module matching a given version constraint”

What I want is to query the IVY repo for what latest version of a given artifact.

Is there any way to do the same in Gradle.
I am just started on the journey to learn Gradle, so …

I have tried to called the task by importing the class from the ivy-2.2.0.jar file that is distributed with Gradle, but no success.
I have also tried to find a solution using only gradle/groovy from the gradle-api, but with no success.

Per A.

Hi, to answer my own question.
I managed to find a solution that solves that task of finding the latest revision.

I did this by creating a dynamic dependency and resolving the version number from that.
It is not an implementation of the ant task ‘findrevision’, but I achieve the same result.

Basically I have a list of artifacts in an xml-file where the version number might be set to ‘latest.release’, ‘latest.milestone’ or 'latest-integration’
So I search trough that xml-file and replaces ‘latest.<…>’ with the resolved version number.

My code looks like:

if (artifact.@number.startsWith(“latest.”)) {
def organisation = artifact.@org
def module = artifact.@module
def numberConstraint = artifact.@number

 def dependency = project.dependencies.create("${organisation}:${module}:${numberConstraint}")
 def configuration = project.configurations.detachedConfiguration(dependency)

 def resolvedConfiguration = configuration.resolvedConfiguration
 def resolvedArtifacts = resolvedConfiguration.resolvedArtifacts
 def resolvedVersion = resolvedArtifacts[0].moduleVersion.id.version
 logger.info "Package: ${module},  Resolved version: ${resolvedVersion}"

}

This works for me :smile: