Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why SBT doesn't use resolvers from root project (in multi-module project)

Tags:

sbt

In a multi-module project, SBT doesn't seem to use resolvers when building modules. The resolvers are declared in the root project's build.sbt as follows:

resolvers += "SpringSource Milestone Repository" at "http://repo.springsource.org/milestone"

and the projects are declared like:

lazy val core = project.settings(
    libraryDependencies ++= { ... }
)

But when compiling, the resolvers are not used and I get :

[info] Resolving org.springframework.scala#spring-scala;1.0.0.BUILD-SNAPSHOT ...
[warn]  module not found: org.springframework.scala#spring-scala;1.0.0.BUILD-SNAPSHOT
[warn] ==== local: tried
[warn]   /home/ariskk/.ivy2/local/org.springframework.scala/spring-scala/1.0.0.BUILD-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/springframework/scala/spring-scala/1.0.0.BUILD-SNAPSHOT/spring-scala-1.0.0.BUILD-SNAPSHOT.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.springframework.scala#spring-scala;1.0.0.BUILD-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

Any ideas what might be wrong?

like image 972
kostas.kougios Avatar asked Jan 18 '14 23:01

kostas.kougios


People also ask

What are resolvers in sbt?

sbt resolver is the configuration for repository that contains jars and their dependencies. for example the below is a resolver definition for a repository called Sonatype and it points at snapshot releases (dev versions) resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

What is Project in file in sbt?

A project is defined by declaring a lazy val of type Project. For example, : lazy val util = (project in file("util")) lazy val core = (project in file("core")) The name of the val is used as the subproject's ID, which is used to refer to the subproject at the sbt shell.


1 Answers

Use the following in the root project's build.sbt:

resolvers in ThisBuild += "SpringSource Milestone Repository" at "http://repo.springsource.org/milestone"

in ThisBuild is the answer. See Scopes.

like image 103
Jacek Laskowski Avatar answered Nov 16 '22 04:11

Jacek Laskowski