withSources() for a dependency's dependencies

582 views
Skip to first unread message

Richard Dallaway

unread,
Dec 3, 2010, 8:57:59 AM12/3/10
to simple-build-tool
Hi there - I'm using SBT with Lift and I've added the withSources()
classifier to pull in the source. This works fine, but only for the
dependencies I explicitly list. Is it possible for SBT to pull in the
source on implied dependencies too?

For example, I have a project (full listing at the end) which
references....

"net.liftweb" %% "lift-webkit" % liftVersion % "compile->default"
withSources(),
"net.liftweb" %% "lift-mapper" % liftVersion % "compile->default"
withSources(),
"net.liftweb" %% "lift-wizard" % liftVersion % "compile->default"
withSources(),
"net.liftweb" %% "lift-testkit" % liftVersion % "compile->default"
withSources(),

...and it works just great (thank you!). But lift-proto is also
automatically pulled in as a dependent library from one of those four,
but the -sources.jar is not fetched.

The easy work-around is, of course, to just explicitly add that entry
too. That works for me, so no big deal. But I'd assumed SBT would
maintain the withSources flag as it discovered additional
dependencies.

Of course it's more complicated that that. For example, would I
expect further dependencies to include source (commons-codec, commons-
logging, joda-time, and so on...)? I'm not sure, but I thought I'd
ask the question to see if it can be done.

Cheers
Richard

import sbt._
import de.element34.sbteclipsify._

class Project(info: ProjectInfo) extends DefaultWebProject(info) with
Eclipsify {

val snapshots = ScalaToolsSnapshots

val liftVersion = "2.2-M1"

// uncomment the following if you want to use the snapshot repo
val scalatoolsSnapshot = ScalaToolsSnapshots

// If you're using JRebel for Lift development, uncomment
// this line
override def scanDirectories = Nil
override def jettyWebappPath = webappPath

override def libraryDependencies = Set(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile->default"
withSources(),
"net.liftweb" %% "lift-mapper" % liftVersion % "compile->default"
withSources(),
"net.liftweb" %% "lift-wizard" % liftVersion % "compile->default"
withSources(),
"net.liftweb" %% "lift-testkit" % liftVersion % "compile->default"
withSources(),
"org.mortbay.jetty" % "jetty" % "6.1.22" % "test->default",
"junit" % "junit" % "4.5" % "test->default",
"org.scala-tools.testing" %% "specs" % "1.6.5" % "test->default",
"com.h2database" % "h2" % "1.2.138",
"log4j" % "log4j" % "1.2.16",
"org.slf4j" % "slf4j-log4j12" % "1.6.1",
"mysql" % "mysql-connector-java" % "5.1.6"
) ++ super.libraryDependencies

Mark Harrah

unread,
Dec 4, 2010, 8:08:46 AM12/4/10
to simple-b...@googlegroups.com

https://issues.apache.org/jira/browse/IVY-1003

IvyDE supports this somehow, though. Possibly with a lot of work this
could be handled in sbt, but it would have to be done by someone more
familiar with Ivy.

-Mark

Richard Dallaway

unread,
Dec 6, 2010, 11:05:10 AM12/6/10
to simple-b...@googlegroups.com
On Sat, Dec 4, 2010 at 1:08 PM, Mark Harrah <dmha...@gmail.com> wrote:

IvyDE supports this somehow, though.  Possibly with a lot of work this
could be handled in sbt, but it would have to be done by someone more
familiar with Ivy.

Thanks for looking into this.  As I mentioned, it's not a big thing for me (or possibly anyone), but wanted to comment on how I'd (naively) expected it might work.

Cheers
Richard 
Reply all
Reply to author
Forward
0 new messages