Can't deploy to gitlab maven repository

We are using gitlab.com, free account
I enabled maven repository in settings

I have in pom.xml

<distributionManagement>
      <repository>
          <id>gitlab-maven</id>
          <url>https://gitlab.com/api/v4/projects/MY_PROJECT_ID/packages/maven</url>
      </repository>
</distributionManagement>

In settings.xml I have

<xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <servers>
     <server>
  <id>gitlab-maven</id>
  <configuration>
    <httpHeaders>
      <property>
        <name>Private-Token</name>
        <value>MY_ACCESS_TOCKEN</value>
      </property>
    </httpHeaders>
  </configuration>
    </server>
  </servers>
</settings>

Access tocken was created with “api” permissions

When I do maven deploy I get

Return code is: 401, ReasonPhrase: Forbidden.

What I’m doing wrong?

@pavel Use of the Maven repository is only available in GitLab.com Silver or higher.

@Tristan, Is this still true currently?

1 Like

@cvgaviao It looks like this was moved to GitLab Core in the 13.3 release: https://gitlab.com/gitlab-org/gitlab/-/issues/221259

1 Like