Learning Android Development
Manually Caching And Finding Gradle Dependencies Made Easy
Customize Gradle Dependencies Download With Script
Published in
3 min readMay 11, 2021
One of the main tasks of Gradle is to help the management of code dependencies. When we perform compilation, it will automatically download the dependencies and store them in cache before the compilation.
Have you ever wonder if you can do the following?
- Manually download them ahead (great for some CI environment setup)
- Know exactly where the downloaded cached dependencies are stored
Here, I’m sharing how to create a simple task in Gradle to do that.
Setup a basic task structure
To do that, let’s create a skeleton of a task as below.
task resolveDependencies {
setDescription "Resolves all projects dependencies."
setGroup "Build Server"
doLast {
// Some code to loop through all configurations
}
}
If you like to learn about basic task in Gradle in general, check out this article