Skip to content

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

Description

@ppalaga

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions