apache / apache/maven-wrapper

Avoid getting HTTP 429 through honoring repositories defined in settings.xml

Open
#421 6 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
254
Forks
78
Avg merge
5h 26m
Merged PRs (30d)
2

Description

### New feature, improvement proposal

We recently started getting HTTP 429 from Maven Central when performing builds on a company internal Jenkins:

```
./mvnw -B -e -s path/to/settings.xml ...
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 429 for URL: https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:2037)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
at org.apache.maven.wrapper.DefaultDownloader.downloadInternal(DefaultDownloader.java:100)
at org.apache.maven.wrapper.DefaultDownloader.download(DefaultDownloader.java:86)
at org.apache.maven.wrapper.Installer.createDist(Installer.java:84)
at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:160)
at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:73)
```

I know there is a possibility to change `distributionUrl` in `.mvn/wrapper/maven-wrapper.properties`
Unfortunately, it is not feasible in this case, because it is a public git repository that can be built by anybody, so we cannot set a company internal `distributionUrl`.

I wonder whether it would be possible to implement some basic parsing of maven mirrors and an repositories present in settings.xml and respect those when downloading the distro?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the wrapper download flow through DefaultDownloader, Installer, and WrapperExecutor, then inspect how .mvn/wrapper/maven-wrapper.properties and the supplied settings.xml are handled. Check existing tests around distribution downloads and settings parsing. Done means repository or mirror definitions from settings.xml are honored during distro downloads without breaking builds that do not provide those settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.