Gradle buildSrc for managing your dependency versions
Gradle buildSrc is a standard approach for implementing
- custom plugins
- tasks
- specifying common configurations (dependency list and versions)
but it invalidates a build cache when it is changed.
How to use it ?
- Create a module with name buildSrc
- Inside your build.gradle.kts
| // projectRoot/buildSrc/build.gradle.kts | |
| plugins { | |
| `kotlin-dsl` | |
| `java-gradle-plugin` | |
| } |
Now create a singleton with all the constants for the dependency
| object Deps { | |
| const val kotlinStdLib = "..." | |
| } |
For implementation we do as follows:
| dependencies { | |
| implementation(Deps.kotlinStdLib) | |
| } |
Comments
Post a Comment