Skip to content

Need support for multiple maven repositories #828

Description

@sudiptosarkar

Description:
Need for support of multiple maven repositories.

Justification:
Custom (JFrog for example) Maven artifactories usually have separate repositories for release and snapshot versions.

Currently this action only supports one repository configuration, which makes it impossible to specify more than one (release and snapshot repositories for example).

That would inevitably lead to changing the maven config in the action yaml every time the version changes to/from release/snapshot.

If we had support for specifying multiple repositories, this problem will not happen at all.

With this support, we'll be able to generate settings.xml like this:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <servers>
    <server>
      <id>artifactory</id>
      <username>${env.ARTIFACTORY_USERNAME}</username>
      <password>${env.ARTIFACTORY_TOKEN}</password>
    </server>
    <server>
      <id>snapshot-artifactory</id>
      <username>${env.SNAPSHOT_ARTIFACTORY_USERNAME}</username>
      <password>${env.SNAPSHOT_ARTIFACTORY_TOKEN}</password>
    </server>
    <server>
      <id>gpg.passphrase</id>
      <passphrase>${env.MAVEN_GPG_PASSPHRASE}</passphrase>
    </server>
  </servers>
</settings>

Are you willing to submit a PR?
Yes, already raised the PR: #827

Activity

  1. v-aparnajyothi-y commented on May 13, 2025

    @v-aparnajyothi-y
    Contributor

    Hello @sudiptosarkar, Thank you for creating this issue and we will get back to you once we have some feedback on this :)

  2. sudiptosarkar commented on May 13, 2025

    @sudiptosarkar
    Author

    @aparnajyothi-y, Just so you know, I raised the PR for the same and linked in the issue description too. 🙂

  3. gian1200 commented on Jun 2, 2026

    @gian1200

    Hello., is there any update on this? It'd be a nice feature to have.

    PS: the PR have some conflicts. It might need to be updated

  4. brunoborges commented on Jun 22, 2026

    @brunoborges
    Contributor

    Extracted from PR #827: support configuring multiple Maven entries in generated settings.xml, each with its own id/username/password mapping, so release and snapshot repositories can be configured at the same time without editing workflow inputs between releases.

    Core idea:

    • Extend setup-java Maven auth generation from a single server tuple to a list of server definitions.
    • Preserve existing single-server inputs for backward compatibility.
    • Add a structured way to provide multiple server credentials (and keep gpg.passphrase support).

    Expected outcome:

    • settings.xml can contain multiple repository server entries in one run.
    • Workflows can publish release/snapshot artifacts without switching config.

    Reference: PR #827

  5. added
    mavenMaven settings, toolchains, and publishing auth
    on Jun 22, 2026
  6. brunoborges commented on Jun 22, 2026

    @brunoborges
    Contributor

    This appears to be a duplicate of #85 ("Add support for multiple servers"). Both stem from the same limitation — setup-java currently supports configuring only a single Maven server entry in settings.xml — so configuring multiple repositories (e.g. separate release/snapshot or multiple registries) isn't possible.

    This is being addressed by PR #1037, which adds a structured multi-server credentials input that generates multiple <server> entries in settings.xml. Tracking the work in #85 / #1037.

  7. brunoborges commented on Jul 28, 2026

    @brunoborges
    Contributor

    Closing as a duplicate of #85. Both issues request multiple Maven <server> credential entries in the generated settings.xml; the release/snapshot use case and structured-input requirements from this issue have been incorporated into #85. Repository URL and dependency-resolution configuration remains tracked separately in #1054.

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

    feature requestNew feature or request to improve the current logicmavenMaven settings, toolchains, and publishing auth

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions