Once downloaded, you can ensure no further network calls are made by using the --offline flag.
On most systems, downloaded artifacts are stored in ~/.gradle/caches/modules-2/files-2.1 . How to download dependencies in gradle - Stack Overflow
Run the custom downloadDependencies task or ./gradlew build --dry-run . gradle only download dependencies
For precise control—such as downloading dependencies specifically for a Docker layer—you can add a custom task to your build.gradle or build.gradle.kts file. This task iterates through all resolvable configurations and forces them to resolve.
tasks.register("downloadDependencies") { doLast { configurations.filter { it.isCanBeResolved }.forEach { it.resolve() } } } Use code with caution. ./gradlew downloadDependencies Once downloaded, you can ensure no further network
task downloadDependencies { doLast { configurations.findAll { it.canBeResolved }.each { it.resolve() } } } Use code with caution.
Finally, copy the src/ directory and run the actual build. Troubleshooting and Offline Mode gradle only download dependencies
The fastest way to trigger a download is by listing the project's dependencies. This forces Gradle to resolve the dependency graph and fetch any missing artifacts into the local cache. ./gradlew dependencies