setup-java icon indicating copy to clipboard operation
setup-java copied to clipboard

Add support for multiple servers.

Open drewctaylor opened this issue 5 years ago • 9 comments

Currently, as I understand it, the user may specify only one server, as follows:

- name: Setup Java.
  uses: actions/setup-java@v1
  with:
    java-version: 1.8
    server-id: value-of-server-id
    server-username: SERVER_USERNAME
    server-password: SERVER_PASSWORD

Which produces the following xml in the settings.xml file:

<server>
  <id>value-of-server-id</id>
  <username>value-of-server-username</username>
  <password>value-of-server-password</password>
</server>

However, it would be useful to be able to specify more than one server. For example, this yaml:

- name: Setup Java.
  uses: actions/setup-java@v1
  with:
    java-version: 1.8
    server-list:
      - server-id: value-of-server-id-1
        server-username: SERVER_USERNAME_1
        server-password: SERVER_PASSWORD_1
      - server-id: value-of-server-id-2
        server-username: SERVER_USERNAME_2
        server-password: SERVER_PASSWORD_2

Might produce the following xml in the settings.xml file:

<server>
  <id>value-of-server-id-1</id>
  <username>value-of-server-username-1</username>
  <password>value-of-server-password-1</password>
</server>
<server>
  <id>value-of-server-id-2</id>
  <username>value-of-server-username-2</username>
  <password>value-of-server-password-2</password>
</server>

While it would be valuable in general to be able to specify more than one server, it should be especially valuable in the context of Github, as it seems for now, in order to reference multiple packages from maven.pkg.github.com, the user must reference each package's repository in their pom.xml.

If the above configuration were possible, a user could then reference the artifacts at value-of-server-id-1 and value-of-server-id-2 in their pom.xml as follows:

<dependencies>
  <dependency>
    <groupId>group-id-for-owner</groupId>
    <artifactId>artifact-id-from-repository-1</artifactId>
    <version>version-1</version>
  </dependency>

  <dependency>
    <groupId>group-id-for-owner</groupId>
    <artifactId>artifact-id-from-repository-2</artifactId>
    <version>version-2</version>
  </dependency>
</dependencies>

<repositories>
  <repository>
    <id>value-of-server-id-1</id>
    <name>GitHub Packages</name>
    <url>https://maven.pkg.github.com/owner/artifact-id-from-repository-1</url>
  </repository>
  <repository>
    <id>value-of-server-id-2</id>
    <name>GitHub Packages</name>
    <url>https://maven.pkg.github.com/owner/artifact-id-from-repository-2</url>
  </repository>
</repositories>

drewctaylor avatar Jul 30 '20 16:07 drewctaylor

what is the current state of this issue?

MCLonips avatar Apr 06 '21 07:04 MCLonips

Same question here. Is this feature on the roadmap? It would be really useful.

perkam avatar May 10 '21 12:05 perkam

Hello everyone. Unfortunately it's not possible to implement right now, because GitHub does not support multiple parameters for arguments. https://github.com/actions/toolkit/issues/184

dmitry-shibanov avatar May 11 '21 08:05 dmitry-shibanov

https://github.com/marketplace/actions/maven-settings-action

torrespro avatar Nov 11 '21 15:11 torrespro

Surely this could be supported with either a toJSON / fromJSON or by taking a file parameter which contains the relevant content.

jsoref avatar Mar 06 '23 13:03 jsoref

Gostaria de saber como funciona

Andreiasilva1 avatar Jun 13 '23 09:06 Andreiasilva1

This would be really helpful to have. @IvanZosimov you closed the duplicate https://github.com/actions/setup-java/issues/427, can you provide an update or ping who can push this forward?

kevinheins avatar Jul 18 '24 21:07 kevinheins

I run into the same issue :-( ! Would be really neat to either

  1. be able to configure multiple servers,
  2. or to access all packages of a given organization via single organization's server: eg: https://maven.pkg.github.com/<Organization>/ over https://maven.pkg.github.com/<Organization>/<Repository>

roman-bicherschii avatar Sep 17 '24 12:09 roman-bicherschii