playframeworksbtcoursierplayframework-2.8

build.sbt error: value addRepositoryAuthentication is not a member of lmcoursier.CoursierConfiguration


I have my private Gitlab lib repository defined as follow:

build.sbt

scalaVersion := "2.13.13"
/*** Gitlab private lib repository configuration ****/
resolvers += "gitlab" at "https://my-gitlab-repo.fun"
val token = "token"

val auth:Authentication = Authentication(Seq(("Private-Token",token)))
csrConfiguration ~= (_.addRepositoryAuthentication("gitlab",auth))
updateClassifiers / csrConfiguration ~= (_.addRepositoryAuthentication("gitlab",auth))

all works fine with sbt version 1.7.2. If I update to 1.7.3 and then run a build command, I get this error:

build.sbt error: overloaded method value apply with alternatives:
(user: String,password: String)lmcoursier.definitions.Authentication <and>
...
val auth:Authentication = Authentication(Seq(("Private-Token",token)))
^
sbt.compiler.EvalException: Type error in expression
[error] sbt.compiler.EvalException: Type error in expression
[error] Use 'last' for the full log.

Ok, no problem, I updated the line:

from:
val auth:Authentication = Authentication(Seq(("Private-Token",token)))

to:
val auth:Authentication = Authentication("Private-Token",token)

Now I run again the build command and the error change in:

build.sbt:59: error: value addRepositoryAuthentication is not a member of lmcoursier.CoursierConfiguration
csrConfiguration ~= (_.addRepositoryAuthentication("gitlab",auth))
^
[error] Type error in expression

Ok, If addRepositoryAuthentication is not a member of lmcoursier.CoursierConfiguration anymore, which method should I use?


Solution

  • Ok, I solved the issue changing the build.sbt configuration in this way:

    val auth:Authentication = Authentication("Private-Token",tokens.head)
    val vector = Vector(("gitlab", auth))
    csrConfiguration ~= (_.withAuthenticationByRepositoryId(vector))
    updateClassifiers / csrConfiguration ~= (_.withAuthenticationByRepositoryId(vector))