I have a jar published to the GitLab Package Registry by Maven (it’s a Java application) and now I’d like to add this jar as a dependency to my Scala app.
Trying the following build.sbt:
version := "1.0"
scalaVersion := "2.12.18"
crossPaths := false
resolvers += ("gitlab" at "https://private.gitlab.instance.com/api/v4/projects/98437639/packages/maven")
credentials += Credentials("Gitlab Packages Registry", "private.gitlab.instance.com", "<TOKEN_NAME>", "<TOKEN_VALUE>")
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-sql" % "3.2.3",
"xx.xx.yy.yy.project" %% "project-xx" % "1.0.0"
)
and I’m getting “unauthorized” when downloading the dependency from gitlab.
Additionally, when I’m accessing the link to the pom/jar from the error message via the browser authenticated with my personal credentials, it works just fine, so there is no problem with the package availability in the registry or whatever.
I followed the instruction available here for sbt. In terms of the name parameter I tried using the name of the token, my username and also the Maven’s “Deploy/Project-Token” names.
The sbt-gitlab plugin as per the Importing Jar from Gitlab package registry also didn’t do the trick for me.
I’ve also tried following the same instruction for Maven and was able to resolve this dependency successfully within a Java project (using exactly the same token).