How to prevent gradlew from download anything?
Asked Answered
A

1

10

I am trying to run gradlew on offline machine. It starts from message

Downloading https://services.gradle.org/distributions/gradle-2.10-all.zip

and then fails with exception.

What it wants and how to satisfy it?

Allhallows answered 29/3, 2017 at 8:53 Comment(2)
This system is rather designed to work online - how would dependencies be downloaded otherwise?Discourse
@Discourse so as I wonderAllhallows
S
8

Option 1. If you have possibility go online temporary

Command gradlew means you are trying to use Gradle Wrapper. It is a tool for automated downloading of Gradle distribution.

In order to download Gradle Wrapper you have to execute gradlew command with a proper network connection at least once. Make sure you have correct network and proxy settings.

./gradlew build

Only after that you can build a project offline. Example:

./gradlew build --offline

Option 2. Download distribution by hand

Or, alternatively, you could download distribution from official site. Then extract it, add gradle to PATH variable, and run:

gradle build --offline
Sayles answered 29/3, 2017 at 12:22 Comment(4)
No, it is trying to access internet nevertheless. Tried command gradlew test --offlineAllhallows
Off course, it depends on a specific build. Sometimes third-party plugins don't honor this parameter. Please provide the error output.Sayles
This question is about auto-downloading the gradle wrapper, not the dependencies of the project.Shedevil
@MirceaD. Thanks for the hint. I've fixed itSayles

© 2022 - 2024 — McMap. All rights reserved.