'Base gradle project to maintain common dependencies can be re-used across all other micro service projects
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.
Solution 1:[1]
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 {
...
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ToYonos |
