Is it possible to make --offline switch to default setting from build.gradle

How can I set the dependency resolution into offline from the build.gradle? I have seen the offline mode stored in a StartParameter class. I guess I have to call the setOffline(true) in initialization life-cycle. Is this the right solution?

You can achieve that by changing the start parameter in the build script:

gradle.startParameter.setOffline(true)

Hope that helps!