spring-gradle-plugins / dependency-management-plugin

A Gradle plugin that provides Maven-like dependency management functionality
686 stars 85 forks source link

Provide a way to programmatically access declared dependencyManagement imports #304

Closed candrews closed 3 years ago

candrews commented 3 years ago

It would be great to have a way to programmatically access dependencyManagement imports in a similar way to how managed versions can be programmatically accessed.

For example, given this build.gradle:

plugins {
    id 'java'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}

repositories {
    mavenCentral()
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:2020.0.0"
    }
}

It would be great to be able to do: def imports = dependencyManagement.imports where imports would be a collection of the declared dependencies (in this case, just one item, org.springframework.cloud:spring-cloud-dependencies:2020.0.0), the data type Dependency seems appropriate for that collection.

One use case for the ability to programmatically access the declared imports would be to allow Renovate to discover these dependencies and therefore suggest updates to them, as it does for other gradle-declared dependencies. See https://github.com/renovatebot/renovate/issues/4614

wilkinsona commented 3 years ago

Thanks for the suggestion. I’d prefer to handle this via https://github.com/spring-gradle-plugins/dependency-management-plugin/issues/226.