ComponentMetadataDetails from items in a resolved configuration

(Justin Ryan) #1

Can someone confirm that dependencies.components.eachComponent is only called on a cache-miss? I.e. only the first time a component is visited, and NOT on subsequent runs of Gradle?

I have a use-case which requires access to the ModuleMetadata in a afterResolve check, which isn’t available in any easy way. My first stab was to save the details.metadata field while in the eachComponent for processing in afterResolve, which was working, but only on the first occasion. The use-case would be equivalent to the maven release plugin which ensures that there are no snapshot dependencies when releasing. There is no way in Gradle, as far as I can tell, to accomplish this when using Ivy modules which require access to the status field to determine this.

It might be another issue but it’s pretty clear that the resolve cache stores all sorts of info, but not status,meaning it’s essentially not available outside of the initial resolve. :frowning:

(Peter Niederwieser) #2

I think ‘eachComponent’ should be called backed for every resolve. Raised GRADLE-2903.