我的私有 Gitlab lib 存储库定义如下:
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))
sbt 版本一切正常
1.7.2
。如果我更新到 1.7.3 然后运行构建命令,我会收到此错误:
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.
好的,没问题,我更新了线路:
from:
val auth:Authentication = Authentication(Seq(("Private-Token",token)))
to:
val auth:Authentication = Authentication("Private-Token",token)
现在我再次运行构建命令,错误更改为:
build.sbt:59: error: value addRepositoryAuthentication is not a member of lmcoursier.CoursierConfiguration
csrConfiguration ~= (_.addRepositoryAuthentication("gitlab",auth))
^
[error] Type error in expression
好的,如果
addRepositoryAuthentication
不再是lmcoursier.CoursierConfiguration
的成员,我应该使用哪种方法?
好的,我通过这种方式解决了更改
build.sbt
配置的问题:
val auth:Authentication = Authentication("Private-Token",tokens.head)
val vector = Vector(("gitlab", auth))
csrConfiguration ~= (_.withAuthenticationByRepositoryId(vector))
updateClassifiers / csrConfiguration ~= (_.withAuthenticationByRepositoryId(vector))