Accessing dependency POM contents (including transitive dependencies)

We would like to transitively download artifacts from an external maven repository to the filesystem, but still maintain the full maven coordinate information (GAV, classifier, extension), and POM file for all downloads (transitively).

The reason for doing so is because at some future point in time we will want to upload artifacts to a DIFFERENT maven repository, and so it is important to maintain the full GAV/CE coordinate and POM information so it is not lossy.

Using the configurations.x.resolvedConfiguration.resolvedArtifacts, I was able to find all the GAV/CE coordinate information, including for transitively resolved dependencies (great!). However, I did not see a way to ask gradle for the POM files/contents it had downloaded.

How would you recommend accessing this information from the gradle runtime?

As a fallback, I think that using the coordinates, I could build up a POM URI using the proper format, and re-request it from the maven repo. But Iā€™d much prefer to ask Gradle for the information it has already downloaded.

Any suggestions?

Thanks
-Steve

EDIT: fixed title

You can grab the POM via an artifact resolution query.

1 Like