我们最近转到了AWS代码工件库。我们很少有基于SBT的项目需要构建。
以下是我的全局设置:
~/.sbt/0.13/plugins/credentials.sbt
credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
~/.sbt/.credentials
realm=Sonatype Nexus Repository Manager
host=somedomain-1234567890.d.codeartifact.ap-southeast-1.amazonaws.com
user=aws
password=xxxxxxxxxxxxxxxxxx
其中password
来自下面的CODEARTIFACT_AUTH_TOKEN
:
export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain somedomain --domain-owner 1234567890 --query authorizationToken --output text`
在项目层面,我有
/build.sbt
...
resolvers := Seq(
...
"Private Nexus" at "https://somedomain-1234567890.d.codeartifact.ap-southeast-1.amazonaws.com/maven/superone-snapshots",
...
)
...
然而,当sbt compile
时,我仍然得到:
[error] Unable to find credentials for [somedomain/superone-snapshots @ somedomain-1234567890.d.codeartifact.ap-southeast-1.amazonaws.com].
[error] Is one of these realms misspelled for host [somedomain-1234567890.d.codeartifact.ap-southeast-1.amazonaws.com]:
[error] * Sonatype Nexus Repository Manager
有人成功获得build.sbt以解析到AWS CodeArtifica吗?
谢谢。
存储库的领域是somedomain/superone-snapshots
,您必须将该字符串指定为~/.sbt/.credentials文件中的领域。看见https://www.scala-sbt.org/1.x/docs/Publishing.html#Credentials