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 ->
      file.absolutePath.contains("com.mycompany.sql")
   }

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?

Thanks!

phil

Something like this should work:

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