This is how i have added dependencies in my build.gradle
// Dependency Versioning
apply plugin: 'io.spring.dependency-management'
dependencyManagement {
imports {
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Edgware.RELEASE'
mavenBom 'io.pivotal.spring.cloud:spring-cloud-services-dependencies:1.5.0.RELEASE'
mavenBom 'org.springframework.boot:spring-boot-dependencies:1.5.15.RELEASE'
}
dependencies {
dependency 'io.springfox:springfox-swagger2:2.8.0'
dependency 'io.springfox:springfox-swagger-ui:2.8.0'
dependency 'org.flywaydb:flyway-core:4.2.0'
dependency 'com.microsoft.sqlserver:mssql-jdbc:6.2.2.jre8'
}
}
I am looking to add a custom-number with each dependency. This number is our Approval number provided by our Architecture team for approval of using that dependency within our enterprise..
Say if my Architecture team has Approved to use io.springfox:springfox-swagger2:2.8.0
dependency and if the approval number is APPL-1054
then i have to add this number also as a metadata
along within the dependency tag with which i will have a different gradle task to consume those numbers
something that looks like dependency 'io.springfox:springfox-swagger2:2.8.0' : APPL-1054
Please help with your ideas
You could set the approvals in a Map then use dependency resolution to validate the approvals. The map could come from some web source as long as you can get it to a map somehow. Here is a simple example
Now if we run
./gradlew clean build
we get an error as an unapproved dependency was added.Of course you could move this functionality to a custom plugin or such but I think the base idea holds.