[0.11] dependsOn MatchError

24 views
Skip to first unread message

tobym

unread,
Jan 13, 2012, 10:57:18 AM1/13/12
to simple-build-tool
I'm trying to set up a project with a dependency on another project,
but it's giving me a MatchError when resolving the dependent project.

Relevant facts:
* sbt 0.11.2
* failing project and the dependency are both Play 2.0 Scala projects

Here is the Build.scala in failing project:

import sbt._
import Keys._
import PlayProject._

object ApplicationBuild extends Build {

val appName = "myApp"
val appVersion = "1.0.0-SNAPSHOT"

val appDependencies = Seq(
// Add your project dependencies here,
)

val main = PlayProject(appName, appVersion,
appDependencies).settings(defaultScalaSettings:_*).settings(
organization := "com.example",
credentials += Credentials(Path.userHome / ".ivy2" /
".credentials")
) dependsOn (otherProj)
val otherProj = ProjectRef( file("../otherProj"), "other-proj")

}



Here is the error I get when starting up sbt in the failing project.
This only occurs when "dependsOn (otherProject)" is included in the
build definition.


scala.MatchError: null
at sbt.Scope$.resolveProjectBuild(Scope.scala:67)
at sbt.Load$$anonfun$17$$anonfun$apply$20.apply(Load.scala:
352)
at sbt.Load$$anonfun$17$$anonfun$apply$20.apply(Load.scala:
352)
at sbt.Project$class.resolveDep$2(Project.scala:50)
at sbt.Project$$anonfun$resolveDeps$2$1.apply(Project.scala:
49)
at sbt.Project$$anonfun$resolveDeps$2$1.apply(Project.scala:
49)
at scala.collection.TraversableLike$$anonfun$map
$1.apply(TraversableLike.scala:194)
at scala.collection.TraversableLike$$anonfun$map
$1.apply(TraversableLike.scala:194)
at scala.collection.LinearSeqOptimized
$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike
$class.map(TraversableLike.scala:194)
at scala.collection.immutable.List.map(List.scala:45)
at sbt.Project$class.resolveDeps$2(Project.scala:49)
at sbt.Project$$anonfun$resolveBuild$2.apply(Project.scala:
51)
at sbt.Project$$anonfun$resolveBuild$2.apply(Project.scala:
51)
at sbt.Project$ProjectDef.dependencies(Project.scala:130)
at sbt.ProjectDefinition$class.uses(Project.scala:23)
at sbt.Project$ProjectDef.uses(Project.scala:126)
at sbt.ProjectDefinition$class.referenced(Project.scala:24)
at sbt.Project$ProjectDef.referenced(Project.scala:126)
at sbt.Load$$anonfun$referenced$1.apply(Load.scala:578)
at sbt.Load$$anonfun$referenced$1.apply(Load.scala:578)
at scala.collection.TraversableLike$$anonfun$flatMap
$1.apply(TraversableLike.scala:200)
at scala.collection.TraversableLike$$anonfun$flatMap
$1.apply(TraversableLike.scala:200)
at scala.collection.LinearSeqOptimized
$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike
$class.flatMap(TraversableLike.scala:200)
at scala.collection.immutable.List.flatMap(List.scala:45)
at sbt.Load$.referenced(Load.scala:578)
at sbt.Load$.loaded(Load.scala:264)
at sbt.Load$.loadAll(Load.scala:284)
at sbt.Load$.loadURI(Load.scala:240)
at sbt.Load$.load(Load.scala:236)
at sbt.Load$.load(Load.scala:234)
at sbt.Load$.apply(Load.scala:118)
at sbt.Load$.defaultLoad(Load.scala:37)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl
$2.apply(Main.scala:513)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl
$2.apply(Main.scala:510)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply
$2.apply(Command.scala:62)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply
$2.apply(Command.scala:62)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply
$3.apply(Command.scala:64)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply
$3.apply(Command.scala:64)
at sbt.Command$.process(Command.scala:92)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply
$1.apply(Main.scala:121)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply
$1.apply(Main.scala:121)
at sbt.State$$anon$1.process(State.scala:154)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:121)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:121)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.MainLoop$.next(Main.scala:121)
at sbt.MainLoop$.run(Main.scala:114)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(Main.scala:
103)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(Main.scala:
100)
at sbt.Using.apply(Using.scala:25)
at sbt.MainLoop$.runWithNewLog(Main.scala:100)
at sbt.MainLoop$.runAndClearLast(Main.scala:83)
at sbt.MainLoop$.runLoggedLoop(Main.scala:67)
at sbt.MainLoop$.runLogged(Main.scala:60)
at sbt.xMain.run(Main.scala:33)
at xsbt.boot.Launch$.run(Launch.scala:54)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:
43)
at xsbt.boot.Launch$.launch(Launch.scala:68)
at xsbt.boot.Launch$.apply(Launch.scala:14)
at xsbt.boot.Boot$.runImpl(Boot.scala:25)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
[error] scala.MatchError: null






Before setting this up, I tested the dependsOn configuration with two
stub sbt projects; this worked fine with the following Build.scala:

import sbt._
import Keys._

object Bar extends Build {
lazy val bar = Project("Bar", file("."), settings =
Defaults.defaultSettings ++ Seq(
scalaVersion := "2.9.1"
)) dependsOn (foo)
val foo = ProjectRef( file("../foo"), "Foo")
}



So perhaps the problem is with the PlayProject, but since the error in
in sbt Scope.scala, I think this is the correct place to start looking
for a solution.

Mark Harrah

unread,
Jan 13, 2012, 7:38:43 PM1/13/12
to simple-b...@googlegroups.com
On Fri, 13 Jan 2012 07:57:18 -0800 (PST)
tobym <toby.ma...@gmail.com> wrote:

> I'm trying to set up a project with a dependency on another project,
> but it's giving me a MatchError when resolving the dependent project.

This is an initialization order error and is not sbt-specific...

> Relevant facts:
> * sbt 0.11.2
> * failing project and the dependency are both Play 2.0 Scala projects
>
> Here is the Build.scala in failing project:
>
> import sbt._
> import Keys._
> import PlayProject._
>
> object ApplicationBuild extends Build {
>
> val appName = "myApp"
> val appVersion = "1.0.0-SNAPSHOT"
>
> val appDependencies = Seq(
> // Add your project dependencies here,
> )
>
> val main = PlayProject(appName, appVersion,
> appDependencies).settings(defaultScalaSettings:_*).settings(
> organization := "com.example",
> credentials += Credentials(Path.userHome / ".ivy2" /
> ".credentials")
> ) dependsOn (otherProj)

This references otherProj before it is initialized, so it is null. Either put otherProj before main or use 'lazy val'.

-Mark

Reply all
Reply to author
Forward
0 new messages