scalamavensbtivysbt-plugin

SBT Resolving issues with Internal Repository


We're trying to build an SBT Project using only our internal company Artifactory. Therefore we copied all required dependencies from the original repositories to ours, maintaining the URL paths. This has worked fine for all repositories except this one: repo.scala-sbt.org.

It seems that now SBT tries to resolve Ivy dependencies (which are hosted on repo.scala-sbt.org) as Maven dependencies.

As an example: the download URL for the dependency "sbt-twirl" originally looks like this:

.../com.typesafe.sbt/sbt-twirl/scala_2.12/sbt_1.0/1.5.1/ivys/ivy.xml

When using our internal repo however, SBT suddenly resolves it like this:

.../com/typesafe/sbt/sbt-twirl_2.12_1.0/1.5.1/sbt-twirl-1.5.1.pom

The URL has changed from ivy.xml to .pom, and this leads to a 404 because the URLs in our internal repo are replicas of the external ones.

Do I have to tell SBT somewhere that our internal repo can also be used for Ivy dependencies? Or what is the reason for this behavior?

The ~/.sbt/repositores file looks like this (schematically):

[repositories]
maven-central: http://internal-repo-url/mvn_repo_path,allowInsecureProtocol
sbt-releases: http://internal-repo-url/sbt_repo_path,allowInsecureProtocol

Solution

  • The solution has been to add this configuration to the repository that is supposed to resolve Ivy dependencies (see part after the comma):

    [repositories]
    my-ivy-proxy-releases: https://repo-url/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
    

    This goes into the ~/.sbt/repositories Config File