Skip to content

Instantly share code, notes, and snippets.

@bwmcadams
Created Feb 6, 2012
Embed
What would you like to do?
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? r
[info] Loading global plugins from /Users/brendan/.sbt/plugins
[info] Loading project definition from /Users/brendan/code/mongodb/mongo-hadoop/project
[info] Compiling 1 Scala source to /Users/brendan/code/mongodb/mongo-hadoop/project/target/scala-2.9.1/sbt-0.11.2/classes...
[error] Reference to undefined setting:
[error]
[error] {.}/*:hadoop-release from {.}/*:library-dependencies
[error]
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
import sbt._
import Keys._
object MongoHadoopBuild extends Build {
/** The version of Hadoop to build against. */
lazy val hadoopRelease = SettingKey[String]("hadoop-release", "1.0.0")
private val stockPig = "0.9.1"
private val cdhRel = "cdh3u3"
private val cdhHadoop = "0.20.2-%s".format(cdhRel) // current "base" version they patch against
private val cdhPig = "0.8.1-%s".format(cdhRel)
protected var streamingEnabled = false
override lazy val settings = super.settings ++ Seq(
libraryDependencies <++= (scalaVersion, libraryDependencies, hadoopRelease) { (sv, deps, hr: String) =>
val hadoopMap = Map("0.20" -> hadoopDependency("0.20.205.0", stockPig, false),
"0.20.x" -> hadoopDependency("0.20.205.0", stockPig, false),
"0.21" -> hadoopDependency("0.21.0", stockPig, true),
"0.21.x" -> hadoopDependency("0.21.0", stockPig, true),
"1.0" -> hadoopDependency("1.0.0", stockPig, false),
"1.0.x" -> hadoopDependency("1.0.0", stockPig, false),
"cdh" -> hadoopDependency(cdhHadoop, cdhPig, true),
"cdh3" -> hadoopDependency(cdhHadoop, cdhPig, true),
"cloudera" -> hadoopDependency(cdhHadoop, cdhPig, true))
val hadoopDeps = hadoopMap.getOrElse(hr, sys.error("Hadoop Release '%s' is an invalid/unsupported release. Valid entries are %s".format(hr, hadoopMap)))
hadoopDeps
})
lazy val root = Project(id = "mongo-hadoop", base = file("."))
def hadoopDependency(hadoopVersion: String, pigVersion: String, useStreaming: Boolean) = {
println("Adding Hadoop Dependencies for Hadoop '%s', with Pig '%s'. Streaming Support? %s".format(hadoopVersion, pigVersion, useStreaming))
val deps = Seq(
"org.apache.hadoop" % "hadoop-core" % hadoopVersion,
"org.apache.pig" % "pig" % pigVersion
)
if (!useStreaming) {
println("Hadoop Streaming cannot be compiled as it requires either Cloudera's Hadoop Distribution or Apache Hadoop 0.21")
deps
} else {
streamingEnabled = true
println("Enabling build of Hadoop Streaming.")
deps ++ Seq("org.apache.hadoop" % "hadoop-streaming" % hadoopVersion)
}
}
}
// vim: set ts=2 sw=2 sts=2 et:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment