Search code examples
scalasbtmaven-3github-package-registrygithub-packages

http4s-request-signer_2.13 dependency is not downloaded from central repository


As I build scala project using >sbt assembly , I am getting the below error. Should I configure anything to resolve this issue?

[info] Strategy 'rename' was applied to 6 files (Run the task at debug level to see details)
[error] sbt.librarymanagement.ResolveException: Error downloading pl.abankowski:http4s-request-signer_2.13:0.4.3
[error]   Not found
[error]   Not found
[error]   not found: /home/ubuntu/.ivy2/localpl.abankowski/http4s-request-signer_2.13/0.4.3/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/pl/abankowski/http4s-request-signer_2.13/0.4.3/http4s-request-signer_2.13-0.4.3.pom
[error]   not found: https://oss.sonatype.org/content/repositories/snapshots/pl/abankowski/http4s-request-signer_2.13/0.4.3/http4s-request-signer_2.13-0.4.3.pom
[error]   unauthorized: https://maven.pkg.github.com/abankowski/http-request-signer/pl/abankowski/http4s-request-signer_2.13/0.4.3/http4s-request-signer_2.13-0.4.3.pom
[error] Error downloading pl.abankowski:http-request-signer-core_2.13:0.4.3
[error]   Not found
[error]   Not found
[error]   not found: /home/ubuntu/.ivy2/localpl.abankowski/http-request-signer-core_2.13/0.4.3/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/pl/abankowski/http-request-signer-core_2.13/0.4.3/http-request-signer-core_2.13-0.4.3.pom
[error]   not found: https://oss.sonatype.org/content/repositories/snapshots/pl/abankowski/http-request-signer-core_2.13/0.4.3/http-request-signer-core_2.13-0.4.3.pom
[error]   unauthorized: https://maven.pkg.github.com/abankowski/http-request-signer/pl/abankowski/http-request-signer-core_2.13/0.4.3/http-request-signer-core_2.13-0.4.3.pom
[error]         at lmcoursier.CoursierDependencyResolution.unresolvedWarningOrThrow(CoursierDependencyResolution.scala:258)
[err



lazy val commonSettings = Seq(
  scalacOptions ++= List("-Ymacro-annotations", "-Yrangepos", "-Wconf:cat=unused:info", "-language:reflectiveCalls"),
  scalafmtOnCompile := true,
  scalafixOnCompile := true,
  resolvers ++= List(
    Resolver.sonatypeRepo("snapshots"),
    Resolver.githubPackages("abankowski", "http-request-signer")
  )
)

Solution

  • I guess it's not published at Maven central. It's in Github Packages here: https://github.com/abankowski/http-request-signer

    Tab "Packages": https://github.com/abankowski?tab=packages&repo_name=http-request-signer

    To work with Github Packages via sbt you can use this plugin: https://github.com/djspiewak/sbt-github-packages

    So add to project/plugins.sbt

    addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3")
    

    Add to build.sbt

    resolvers += Resolver.githubPackages("abankowski")
    
      // this is default so could be omitted
    githubTokenSource := TokenSource.Environment("GITHUB_TOKEN") 
    
    libraryDependencies ++= Seq(
      "pl.abankowski" %% "http4s-request-signer" % "0.4.3",
      "pl.abankowski" %% "http-request-signer-core" % "0.4.3",
    )
    

    Add environment variable (e.g. in ~/.profile)

    export GITHUB_TOKEN=...................
    

    You can get the token at https://github.com/settings/tokens

    The token should have permission "Download packages from GitHub Package Registry" read:packages.


    There is also an option to configure the token in ~/.gitconfig

    githubTokenSource := TokenSource.GitConfig("github.token")
    

    .gitconfig

    [github]
      token = .........................