Gradle Tooling: Collecting dependencies list without downloading

Hi there,

I’m using the Gradle Tooling API to programmatically extract the list of other projects’ dependencies.

To put schematically, this is the code I’m using for it:

val connector = GradleConnector.newConnector()
val connection = connector.forProjectDirectory(<projectDir>).connect()
val project: EclipseProject = connection.model(classOf[EclipseProject]).get()
val domainObjectSet = project.getClasspath
val gradleModuleVersions = domainObjectSet.asScala.map(_.getGradleModuleVersion)
val result = gradleModuleVersions.filter(_ != null).toSet

connection.close()

This code runs in the container in brand new environment, thus downloads the Gradle’s zip and caches all the dependencies. The latter takes a lot of time and seems unnecessary.

So, my question is whether there’s a more lightweight way to obtain the project’s dependencies list without having to download all of them?
Maybe there’s a different model, other than EclipseProject, that would suit my needs better?

Thanks in advance.