Is there a way to get the group, artifact name, and version of an artifact from a gradle configuration?

I want to search my gradle configurations for artifacts and be able to detect the group, artifact, and version for each artifact.

def files = project.configurations.compile.findAll { File file ->

This returns files… so I’d have to parse these out of the file name. Is there a better way to just grab the group?



Something like this should work:

configurations.compile.resolvedConfiguration.resolvedArtifacts.collect { }.each { ModuleVersionIdentifier id ->
  println "${}:${}:${id.version}"