Skip to content

Add support for multiple servers. #85

Description

@drewctaylor

Summary

Support configuring multiple Maven <server> credential entries in the generated settings.xml during one setup-java run.

Today the action's legacy server-id, server-username, and server-password inputs describe only one server. That prevents workflows from configuring credentials for multiple registries or for separate release and snapshot repositories without generating or patching settings.xml themselves.

Use cases

  • Separate release and snapshot repositories in Artifactory, Nexus, or another private registry.
  • Multiple GitHub Packages repositories requiring distinct server IDs.
  • Publishing or resolving artifacts against multiple authenticated Maven repositories in the same workflow.

Proposed behavior

Add a structured multiline input for multiple server definitions, with one independent server ID, username environment-variable name, and password environment-variable name per entry. For example:

mvn-server-credentials: |
  releases:RELEASES_USERNAME:RELEASES_PASSWORD
  snapshots:SNAPSHOTS_USERNAME:SNAPSHOTS_PASSWORD

This should generate:

<servers>
  <server>
    <id>releases</id>
    <username>${env.RELEASES_USERNAME}</username>
    <password>${env.RELEASES_PASSWORD}</password>
  </server>
  <server>
    <id>snapshots</id>
    <username>${env.SNAPSHOTS_USERNAME}</username>
    <password>${env.SNAPSHOTS_PASSWORD}</password>
  </server>
</servers>

The implementation should validate malformed entries and duplicate server IDs.

Compatibility

Existing workflows using server-id, server-username, and server-password must continue to work unchanged when the structured input is not set.

Scope

This issue covers credentials in Maven <servers>. Configuring repository URLs and dependency resolution through <profiles> and <repositories> is complementary work tracked in #1054.

Prior work

Metadata

Metadata

Assignees

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