How to run Gradle build in offline mode


If you want to run the gradle build offline, you can add --offline argument with the build command,

Example:
# gradle --offline build

By doing so gradle Gradle will not connect to the network to download dependencies (jars), If a dependency is not found, Gradle build will fail.

code2care@mac Desktop % gradle -offline build

> Task :app:compileJava UP-TO-DATE
> Task :app:processResources NO-SOURCE
> Task :app:classes UP-TO-DATE
> Task :app:jar UP-TO-DATE
> Task :app:startScripts UP-TO-DATE
> Task :app:distTar UP-TO-DATE
> Task :app:distZip UP-TO-DATE
> Task :app:assemble UP-TO-DATE
> Task :app:compileTestJava UP-TO-DATE
> Task :app:processTestResources NO-SOURCE
> Task :app:testClasses UP-TO-DATE
> Task :app:test UP-TO-DATE
> Task :app:check UP-TO-DATE
> Task :app:build UP-TO-DATE

BUILD SUCCESSFUL in 726ms
7 actionable tasks: 7 up-to-date
Gradle build Offline
Gradle build Offline

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.

Follow Us: GitHub | Facebook | Twitter | Instagram