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

Need support for multiple maven repositories

Open sudiptosarkar opened this issue 9 months ago • 2 comments

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: actions/setup-java#827

sudiptosarkar avatar May 12 '25 19:05 sudiptosarkar

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

aparnajyothi-y avatar May 13 '25 06:05 aparnajyothi-y

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

sudiptosarkar avatar May 13 '25 07:05 sudiptosarkar