API to detect gradle offline mode

Is there an API to detect gradle is executed in offline mode? I’d rather this than using raw Java network detection because one can force gradle offline mode while still having network access (very slow connection or data capped connection, or testing etc.) Furthermore I’m working with a project which provides it’s own repository paradigm and these are not aware of the gradle program args.

Thx

The information about offline mode is available from StartParameter. You can get access to the instance of StartParameter from the Gradle instance, which can be obtained from the Project.

The full path from a project is:
project.gradle.startParameter.offline

It’s not clear to me whether you’re asking something additional about the own repository paradigm.

1 Like

Thank you! This is precisely what I was looking for! I searched and could
not find it.

Sincerely,