How do you programmatically access resolved implementation dependencies?

I would like to access the metadata about a resolved implementation dependency that has its version set via a platform bom

  dependencies {
      implementation platform("internal.spinnaker:clouddriver-bom:${spinnakerRelease}")
      annotationProcessor platform("internal.spinnaker:clouddriver-bom:${spinnakerRelease}")
      testAnnotationProcessor platform("internal.spinnaker:clouddriver-bom:${spinnakerRelease}")

      implementation ""
      implementation ""
      implementation ""

I would like to be able to programmatically access the resolved version of clouddriver-web.
All the solutions I can find online keep referencing code like this.


Which you cannot do with the implementation configuration as it throws an error about not being resolvable.

The end goal is to have the resolved dependency be an entry in META-INF/ so that it can be used like so:

I can’t figure out how to get the version in a task or gradle file.

Any help would be greatly appreciated, cheers!

You can access the resolution result using configurations.runtimeClasspath.incoming.resolutionResult.

The implementation configuration is just a set of dependencies. So you don’t “access the resolved implementation dependencies”. You have to ask Gradle what was resolved for compile (compileClasspath) or runtime (runtimeClasspath) or annotation processing (annotationProcessor), …