Uploading package to GitLab Maven Repository trough Sbt

Hello,

I am working with a fresh trial of GitLab 13.0.6-ee installed via docker-compose. I would like to investigate the usage of GitLab Package Registry in our projects. Especially the support for Maven artifacts, Npm libraries and containers images.

I can see that my registry is empty via the “Packages & Registries” menu entry. So, I assume that the registry is enabled.

Because this is my main concern, I have tried to upload a package trough Sbt. But I cannot manage to have it working.

I have created a “deploy key” for my project and configured the repository but the publication fail:

credentials += Credentials(
    "GitLab repository",
    "localhost", 
    "sbt-deploy",
    "[HIDDEN]"
)
publishTo := Some(
    "GitLab repository" at 
        "http://localhost/api/v4/projects/2/packages/maven"
)

[error] (publish) java.io.IOException: Access to URL http://localhost/api/v4/projects/2/packages/maven/default/infrastructure_2.12/0.1.0-SNAPSHOT/infrastructure_2.12-0.1.0-SNAPSHOT.pom was refused by the server: Unauthorized; Response Body: {“message”:“401 Unauthorized”}

Please note that when I create the token, I can only see and select the “read_repository” scope.

  1. Why can’t I select the write scopes ?
  2. Do you have succesfully published a maven artifact trough Sbt ?

Thanks

This sums up the discussion of exactly this:

1 Like