I had initially reported this request to IntelliJ IDEA, but figured it might find a better home here.
Running Gradle 4.2.1 with a Java8 based project:
Running Gradle with
--offline is excellent; it provides significant performance improvements specially when internet connectivity is less than great. However, it’s a bit of a “boolean” flag that either affects everything or nothing. I would like to propose a bit of a smarter/hybrid behavior that might work like this:
The offline flag should be able to turn itself on and off again when needed, specially when Gradle determines that a dependency is not available in offline mode. Today, in that situation the build is stopped with an error message that says something to the effect of
No cached version of X is available in offline mode. When this case is encountered, Gradle should try to automatically take itself back online, consulting repositories defined in the build to locate and download the dependency, and when done/successful take itself back offline again.
This should continue to provide the same performance improvements, and not abruptly end the build. Today, one has to take the build back online manually by removing
--offline from the build command, let it download and resolve dependencies and then specify the flag again. Why do that manually, if it can be automated as a new mode/option?