You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Request Maven options to allow maven central mirror url #486
Description:
Currently setup-java action generates the default maven settings.xml on the fly. It defaults to the maven central URL https://repo.maven.apache.org/, which unfortunately had an incident for a few hours on 4/19/2023 when that URL went down and our github actions workflows for CI stopped working. I would like to request if you could add additional option(s) in setup-java action to allow users to enter a maven central mirror URL such as https://repo1.maven.org/maven2 to work around incident like that if/when it occurs.
Justification:
In case of the default maven central URL goes offline, we need a way in the github actions CI workflows to instruct settings.xml auto generated by this action to point to a mirror URL for maven central.
Hi, @wenqiglantz-agi 👋 Unfortunately, we decided to reject your feature request. We believe that adding the functionality that you asked for will add unwanted complexity to the action (one more input and additional logic). Moreover, such incidents with Maven Central are pretty rare, and their consequences could be fixed manually in the steps following the installation of Java.
We are using self-hosted runners and want to use a Maven mirror to reduce the traffic over our internet connection and speed up things. A way to merge the auto-generated settings.xml and our own file, or explicit support for adding mirrors, would have been nice.
Reacted by espenjon-uio, Greg Chabala, Annonymus, Andrew Wharton and rsharma-cuda
mvn-server-credentials and mvn-repositories are great for adding
authenticated custom repositories to the generated settings.xml, but there's
no way to make Maven use those repositories exclusively (i.e., stop falling
back to Maven Central / the default repo for an ecosystem).
Maven's own mechanism for this is a <mirror> with <mirrorOf>*</mirrorOf>,
but the action currently only ever emits <servers> and a <repositories>
profile — never <mirrors>.
Example use case
A team runs a private artifact proxy (e.g. Artifactory/Nexus) and wants ALL
dependency resolution — including anything that would normally come from
Central — to route through that one proxy for auditability/network-policy
reasons. Today, mvn-repositories just adds the private repo as an additional source; Central is still reachable and used unless a mirror is
configured.
Current workaround
Users have to either:
Hand-write/append a <mirrors> block into settings.xml in a separate
shell step after setup-java runs, or
Use a third-party action (e.g. s4u/maven-settings-action, which does
support a mirrors input) instead of / in addition to setup-java.
Suggestion
Add an input like mvn-mirrors (multiline, format mirror-id:mirror-of:repository-url), or a boolean flag such as mvn-repositories-exclusive: true that turns the existing mvn-repositories
list into <mirror mirrorOf="*"> entries instead of plain <repository>
entries.
Secondary/documentation note
mvn-server-credentials / mvn-repositories aren't in any tagged release yet
(confirmed absent in v5/v5.5.0, present only on main as of this
writing). It might be worth a callout in the README/advanced-usage docs
clarifying these are pre-release/main-only, since it's easy to assume they're
available in the latest tagged major version.
Activity
IvanZosimov commentedon Apr 21, 2023
Hi, @wenqiglantz-agi 👋 Thanks for the feature request, we will take a look at it!
IvanZosimov commentedon Sep 1, 2023
Hi, @wenqiglantz-agi 👋 Unfortunately, we decided to reject your feature request. We believe that adding the functionality that you asked for will add unwanted complexity to the action (one more input and additional logic). Moreover, such incidents with Maven Central are pretty rare, and their consequences could be fixed manually in the steps following the installation of Java.
rhuitl commentedon May 29, 2024
We are using self-hosted runners and want to use a Maven mirror to reduce the traffic over our internet connection and speed up things. A way to merge the auto-generated settings.xml and our own file, or explicit support for adding mirrors, would have been nice.
felickz commentedon Aug 18, 2026
Similar feedback:
Problem
mvn-server-credentialsandmvn-repositoriesare great for addingauthenticated custom repositories to the generated
settings.xml, but there'sno way to make Maven use those repositories exclusively (i.e., stop falling
back to Maven Central / the default repo for an ecosystem).
Maven's own mechanism for this is a
<mirror>with<mirrorOf>*</mirrorOf>,but the action currently only ever emits
<servers>and a<repositories>profile — never
<mirrors>.Example use case
A team runs a private artifact proxy (e.g. Artifactory/Nexus) and wants ALL
dependency resolution — including anything that would normally come from
Central — to route through that one proxy for auditability/network-policy
reasons. Today,
mvn-repositoriesjust adds the private repo as anadditional source; Central is still reachable and used unless a mirror is
configured.
Current workaround
Users have to either:
<mirrors>block intosettings.xmlin a separateshell step after
setup-javaruns, ors4u/maven-settings-action, which doessupport a
mirrorsinput) instead of / in addition tosetup-java.Suggestion
Add an input like
mvn-mirrors(multiline, formatmirror-id:mirror-of:repository-url), or a boolean flag such asmvn-repositories-exclusive: truethat turns the existingmvn-repositorieslist into
<mirror mirrorOf="*">entries instead of plain<repository>entries.
Secondary/documentation note
mvn-server-credentials/mvn-repositoriesaren't in any tagged release yet(confirmed absent in
v5/v5.5.0, present only onmainas of thiswriting). It might be worth a callout in the README/advanced-usage docs
clarifying these are pre-release/main-only, since it's easy to assume they're
available in the latest tagged major version.