How does build.sbt resolve to AWS codeartifact repo?

1k views Asked by At

We recently moved to AWS codeartifact repo. We have few SBT based projects that need to get built.

Here are my global settings:

~/.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

where password comes from the CODEARTIFACT_AUTH_TOKEN from below:

export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain somedomain --domain-owner 1234567890 --query authorizationToken --output text`

At project level, I have

./build.sbt

...
resolvers := Seq(
  ...
  "Private Nexus" at "https://somedomain-1234567890.d.codeartifact.ap-southeast-1.amazonaws.com/maven/superone-snapshots",
  ...
)
...

However when sbt compile I still get:

[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

Have anyone successfully got build.sbt to resolve to AWS CodeArtificat?

Thanks.

1

There are 1 answers

0
Massimo Siani On

The realm of your repository is somedomain/superone-snapshots, you have to specify that string as the realm in your ~/.sbt/.credentials file. See https://www.scala-sbt.org/1.x/docs/Publishing.html#Credentials