Maven Repository Setup

Hello I’m trying to set the Maven Repository in Gitlab as an external repository for local development, to be able to share .jars in my team.

I’m using gitlab-ce:14.3.3-ce.0 self-managed in Docker behind an Nginx.

I uploaded a project and manage to create the .jar in the Package Registry section.

I create a Personal Access Token with full permissions and put in my settings.xml like this:

            <value>{my private token}</value>

Plus also configuring the repository in setttings.xml

    <url>https://{my gitlab domain}/api/v4/packages/maven</url>

I tried to execute the command mvn dependency:get -Dartifact={artifact}:{project}:1.0.0 and it failed with this:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:get (default-cli) on project standalone-pom: Couldn’t download artifact: Unable to get dependency information for{artifact}:{project}:jar:1.0.0: Failed to retrieve POM for {artifact}:{project}:jar:1.0.0: Could not transfer artifact {artifact}:{project}:pom:1.0.0 from/to gitlab-maven (https://{my gitlab domain}/api/v4/packages/maven): Authorization failed for https://{my gitlab domain}/api/v4/packages/maven/{artifact}/{project}/1.0.0/cuyawa-util-1.0.0.pom 403 Forbidden

Any one has any idea what I did wrong or this functionality is not available?

1 Like