Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use maven or gradle on an unreliable network?

Tags:

maven

gradle

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.

  • http://maven.apache.org/guides/mini/guide-http-settings.html#Connection_Timeouts
  • https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html

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

like image 929
Christian Goetze Avatar asked Apr 24 '14 00:04

Christian Goetze


People also ask

Should I use Gradle or Maven?

However, there are times that you really do not need most of the features and functionalities it offers. Maven might be best for small projects, while Gradle is best for bigger projects. If you've been working with Maven and find that your project has outgrown it, it is possible to migrate from Maven to Gradle.

Why Maven is better than Gradle?

In maven, the main goal is related to the project phase. It avoids the work by tracking input and output tasks and only runs the tasks that have been changed. Therefore it gives a faster performance. It does not use the build cache; thus, its build time is slower than Gradle.

Can you use Gradle and Maven together?

Short answer: yes. There's no conflict between having two independent build scripts for the same project, one in Maven and one in Gradle.

Is Gradle faster than Maven?

Gradle is between 7 and 85 times faster than Maven when building incremental changes; benefits increase with number of subprojects. Gradle builds are 3 to 30 times faster than Maven builds when task outputs can be resolved Gradle's build cache.


1 Answers

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.

like image 186
Jimilian Avatar answered Sep 30 '22 16:09

Jimilian