Gradle does a good job of avoiding re-downloading artifacts, but you can pass --offline
to Gradle to prevent from accessing the network during builds.
e.g.
gradle --offline build
If it needs something from the network that it doesn’t have, instead of attempting to fetch it, your build will fail.