Gather transitive dependencies and associated JAR files programmaticaly

So, I was able to retrieve the list of artifacts files of the configuration. However, I had to ditch configurations.vendors.incoming.resolutionResult as I was not able to find a good way to retrieve file associated with a DependencyResult. Instead, I used for now configurations.vendors.resolvedArtifacts with a filter on artifact’s group to exclude those generated by project. Anyway, that’s another story.

Now, I would like to also retrieve the associated sources artifact. Do you know how I could do this? I guess I need to call some repository API to retrieve it (hopefully, a cached copy).

As a side note, the old forums and old mailing lists (gradle-user) already contained such information, so sorry for the post, I should have searched more harder. Here some links for posterity:

Regards,
Matt