Get resolved artifacts from configuration and all configurations it extends from

In my testing:


Only gets resolved artifacts for someConfiguration and not any of the configurations that someConfiguration extends from.

In order to get all artifacts from someConfiguration AND all the configurations it extends from, I have been using:

      .map(c -> c.getResolvedConfiguration().getResolvedArtifacts())
      .flatMap(set ->

And this works for my use case. Is this the correct way to go about getting the resolved artifacts from a configuration and all the configurations it extends from? I expected the first approach to do this already…and the documentation is unclear about this.

Hi @abagshaw,

The Configuration API is “historically grown” and used for different purposes now. What you do is fine for the case you describe.

In Gradle core, the pattern we now use is to use inheritance to “collect” dependency declarations from other configurations that act as “dependency buckets”. Artifacts are only added to “consumable configurations”. See for example the setup in the java-library plugin:

And this general description of the “three types” of configurations we now have:

One aspect here is that we only attach aritfacts to configurations if they are “published” (i.e. used/consumed by other projects/modules).

Our of curiosity: What is your use case to use configurations with aritfacts and inheritance?