Available versions of an artifact

I’m looking for an API in buildship/gradle that would allow me to obtain all versions of an artifact available in remote repositories configured for a specific project. I have asked the same question for M2E: [Question] Determine artifact available versions? · Discussion #1213 · eclipse-m2e/m2e-core · GitHub. Now just need Gradle piece for a complete solution.

Initially we were looking for available versions in the Maven Central repo but then decided it’d be great to look for versions for an artifact in repo’s setup for a project in context.

Thanks in advance.

I’m not aware of an API allowing that.
You can get the latest version by using dynamic versions like the gradle-versions-plugin does.
Or you can restrict support to specific repository types like “only Maven repositories” and then use proprietary way to list the versions like the refreshVersions plugin does.