Christian Goetze
Christian Goetze

Reputation: 2414

How to use maven or gradle on an unreliable network?

Naive use of the built-in settings sometimes results in hanging connections. It is likely some network issue outside of my control.

I would like to know how I can set a timeout and a retry for both downloading artifacts and publishing artifacts.

I have found a connection timeout and read timeout setting for HTTP wagon, but I have not found a retry option.

For publishing, I found a retry option, but no timeout setting.

Edit what I want is the equivalent of curl's --max-time, --retry and --retry-delay options for maven and gradle downloads and publishes.

Upvotes: 9

Views: 5349

Answers (2)

Jimilian
Jimilian

Reputation: 3919

I tried to dig into this topic as well, but did not find much. Except one thing. Since Gradle 4.3 (thanks to PR) you can put to gradle.properties something like:

systemProp.org.gradle.internal.http.connectionTimeout=120000
systemProp.org.gradle.internal.http.socketTimeout=120000

Maybe once https://github.com/gradle/gradle/issues/4629 would be resolved, life will be much easier.

Upvotes: 6

djangofan
djangofan

Reputation: 29669

Gradle has built-in Maven compatability and it will create the .m2 or .gradle archive directories for you. To retry, all you need to do is just re-run your build over and over until all artifacts are complete.

Upvotes: -2

Related Questions