Github package registry authentication

I’m using a bespoke dependency management tool that uses the Aether library to manage maven dependencies.

I’d like to integrate support for deploying to github package registry, but I’m not sure what authentication information is required from github.

I assume it’s a matter of setting the right fields on anAether Authentication object.

From looking at what information maven requires I see an entry in the settings.xml

<server>
    <id>github</id>
    <username>username</username>
    <password>1111111111</password>
</server>

Which suggests I only need to set strings “username” and “password”

Despite having set these fields (along with the correct url) I keep getting an error similar to the following

org.eclipse.aether.deployment.DeploymentException: Failed to deploy artifacts: Could not transfer artifact group:a:jar:1.0 from/to github (https://maven.pkg.github.com/user/repo): maven.pkg.github.com failed to respond

Any guidance would be much appreciated.

I’m not sure what that error is exactly. For the server config we recommend using env variables as seen in setup-java. Where the password is a PAT and the username is your github username.

<servers>
    <server>
      <id>github</id>
      <username>${env.GITHUB_ACTOR}</username>
      <password>${env.GITHUB_TOKEN}</password>
    </server>
</servers>
1 Like