How do I get a list of all POMs that are used to resolve a dependency to an maven-artifact?

I tried to collect any artifact that is used by gradle to resolve the dependencies (incl. transitive dependencies). If we have for example a dependency to “commons-logging” (compare the code below), then gradle is downloading the pom of commons-logging and the

parent-POM. I have implemented a DependencyResolutionListener to get a notification, if a dependency was resolved. The resolved dependencies contains a reference to the JAR-file, but I did not see currently a way to get a list of all POMs, that are used by gradle to resolve dependencies. Does anybody knows a way how to get a list of all POMs?

apply plugin: 'java'
apply plugin: 'maven'
  repositories {
  maven { url "http://localhost:8080/artifactory/repo"
  dependencies {
        compile (group: 'commons-logging', name: 'commons-logging', version: '1.1.1')
  task resolveDependency << {
        def listener = new DependencyResolutionListener() {
  afterResolve(ResolvableDependencies dependencies) {
                        println "afterResolve: " + dependencies
                        dependencies.dependencies.each {
                                it.artifacts.each {
                                        println "resolved artifact: " + + "." + it.classifier + "." + it.extension + "." + it.type + ":" + it.url
                                println "resolved dependency: " + it
                        dependencies.files.each {
                                println "dep.file: " + it
  beforeResolve(ResolvableDependencies dependencies) {
                        println "beforeResolve: " + dependencies
          def configuration = project.configurations.getByName('compile')
          def artifacts = new HashSet()

Output of the script above with an empty gradle cache.

beforeResolve: dependencies ':compile'
Download http://localhost:8080/artifactory/repo/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom
Download http://localhost:8080/artifactory/repo/org/apache/apache/4/apache-4.pom
afterResolve: dependencies ':compile'
resolved dependency: DefaultExternalModuleDependency{group='commons-logging', name='commons-logging', version='1.1.1', configuration='default'}
Download http://localhost:8080/artifactory/repo/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
dep.file: /home/haasm/.gradle/caches/artifacts-14/filestore/commons-logging/commons-logging/1.1.1/jar/5043bfebc3db072ed80fbd362e7caf00e885d8ae/commons-logging-1.1.1.jar

If necessary, you could probably locate the POMs by taking into account the cache disk layout (which may, however, change). What do you need them for?

Dear Peter, thank you for your answer. I need the POMs, because I would like to create a cache with artifacts and POMs (incl parent POMs and transitive dependencies ). In contrast to a repository manager (like artifactory or nexus) we have some additional requierements, that are not covered by artifactory or nexus. So we dont want to use a repository manager to cache external libraries in a separate repository. The idea was to create a cache based on the dependency resolution mechanism of gradle. The cache should be structured like a maven repository.

I’d triple-check if Artifactory is not an option; it’s very customizable and extensible. Otherwise, you might end up writing your own little repository manager that has to deal with checksums, sources Jars, Javadoc Jars, etc. Currently, the Gradle APIs only provide access to the “main” artifacts.

Dear Peter. Artifactory is not an option for us. I will try to explain some background information. I’ve evaluated Artifactory PRO and first I thought that we can cover our requierements with the funcational range of Artifactory. For example we have to kept our changes traceable. Each modification of the source code is tagged with a ticket. To ensure, that nobody can checkin without a ticket we’ve implemented a pre-commit-hook on our SVN-server. You can write user plugins for Artifactory, but you can not deploy new artifacts AND add a deploy-message. And this is only one of an larger amount of smaller issues. So we decided, that we have to walk-on an another way.

The current solution idea is to implement a gradle task, that will download any artifacts (POM, JAR, sources, javadoc, tests, documentation and so on) of a new dependency (incl. the transicitive dependencies). In a second step we will commit these libraries in our SVN and deploy the artifacts to our artifactory. Currently we are using ant, maven and gradle to build our different software products and our artifactory shares components and libraries to all of them. So we do not want to write our own repository manager. We have to implement “only” a workflow for adding new dependencies. For that workflow we have to implement some special requirements. I hope, that I could explain my motiviation a little bit.