We have multiple spring boot gradle projects, each project will have its own set of dependencies defined in its build.gradle.
For each quarter we do scan all our project to identify VULNERABLE third party dependencies, based on severity will upgrade the dependencies mentioned in gradle file.
This activity we do it project by project.
To reduce the rework we are planning to define a COMMON BASE GRADLE PROJECT contains common dependencies which is being used across all projects, and base project to be implemented in all other projects.
Kindly suggest options and best practices to achieve this.
Gradle has a simple way to handle such a use case.
Use allprojects
to configure the common/main/core project and each of its sub-projects (common dependencies)
allprojects {
...
}
Use subprojects
to configure the sub-projects of the common/main/core project (dependencies for all child projects only)
subprojects {
...
}
Use project(':aChildProject')
to configure only the sub-projects named aChildProject
project(':aChildProject') {
...
}
Use this code to configure a specific subset of subprojects (here child1
and child3
)
subprojects.findAll { ['child1', 'child3'].contains(it.name) }.each {
it.with {
...
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.