During downloading dependencies by maven, one of it fails due to network issues:
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-failsafe-plugin/2.16/maven-failsafe-plugin-2.16.pom
Plugin org.apache.maven.plugins:maven-failsafe-plugin:2.16 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-failsafe-plugin:jar:2.16
I would like to retry it for n times where n will be configurable. How can I do this?
I had a similar problem in Gitlab CI/CD. This seems to have resolved the issue:
-Dmaven.wagon.http.retryHandler.count=3
Since version 3.2, the retry handler can be configured with system properties:
...
maven.wagon.http.retryHandler.count= number of retries for default or standard implementations.
Other HTTP client settings are described here: https://maven.apache.org/wagon/wagon-providers/wagon-http/
Edit: As keiki pointed out in the comments, 3 appears to be the default, so it's not clear how setting this value would help. Please comment with your experience.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With