Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do "transitive resolvers" work with SBT?

Tags:

sbt

ivy

I have the following project build:

import sbt._
import Keys._

object ProjectBuild extends Build {

  val buildVersion = "0.1-SNAPSHOT"

  val delvingReleases = "Delving Releases Repository" at "http://development.delving.org:8081/nexus/content/repositories/releases"
  val delvingSnapshots = "Delving Snapshot Repository" at "http://development.delving.org:8081/nexus/content/repositories/snapshots"
  val delvingRepository = if (buildVersion.endsWith("SNAPSHOT")) delvingSnapshots else delvingReleases

  lazy val root = Project(
    id = "basex-scala-client",
    base = file(".")
  ).settings(

    organization := "eu.delving",
    version := buildVersion,

    resolvers += "BaseX Repository" at "http://files.basex.org/maven",

    libraryDependencies += "org.basex"  %     "basex" % "7.2.1",
    libraryDependencies += "org.specs2" %%    "specs2" % "1.7.1" %  "test",

    publishTo := Some(delvingRepository),

    credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"),

    publishMavenStyle := true
  )

}

When I include the resulting library in another project, like so:

    "eu.delving"         %% "basex-scala-client"         % "0.1-SNAPSHOT"

and I try to build that project, I get an error prompting me that the "org.basex % basex % 7.2.1" library referenced by that project cannot be found.

I have to go and add the resolver in the "client" project in order for the library to be found. Is there a way to avoid this?

like image 525
Manuel Bernhardt Avatar asked May 23 '12 20:05

Manuel Bernhardt


1 Answers

There's no transitive resolvers, so the build user needs to know all the resolvers of all the transitive library dependencies. The benefit of this approach is that on the opensource projects, it encourages projects to publish to one of the known repositories connected to the known resolvers.

For corporate usage, you can prevent your traffic from going to unknown places introduced by some dependencies down the graph.

To share resolver settings within the organization, you can create an org-wide plugin.

like image 194
Eugene Yokota Avatar answered Sep 19 '22 15:09

Eugene Yokota