Reputation: 343
I need to include a dependency from git in my SBT build. I've followed some other examples I've found on stackoverflow and got this far:
lazy val commonSettings = Seq(
version := "0.1.0",
scalaVersion := "2.10.5"
)
lazy val elastic = ProjectRef(uri("git://github.com/elastic/elasticsearch-hadoop.git"), "elasticsearch-hadoop")
// Library dependencies
lazy val indexer = (project in file("."))
.settings(commonSettings: _*)
.dependsOn(elastic)
.settings(
projectDependencies := {
Seq(
(projectID in elastic).value.
exclude("commons-beanutils", "commons-beanutils-core").
exclude("commons-collections", "commons-collections").
exclude("commons-logging", "commons-logging").
exclude("com.esotericsoftware.minlog", "minlog").
exclude("org.apache.hadoop", "hadoop-yarn-common-2.2.0").
exclude("org.apache.spark", "spark-network-common_2.10").
exclude("org.apache.spark", "spark-sql_2.10"))
})
.settings(
libraryDependencies ++=Seq(
"org.apache.spark" %% "spark-core" % "1.6.1" % "provided",
"org.apache.spark" %% "spark-sql" % "1.6.1" % "provided"
))
When running assembly I get the following error:
[error] /Users/nandanrao/Documents/Relink/indexer/indexer.scala:4: object elasticsearch is not a member of package org
[error] import org.elasticsearch.spark.sql._
In the other examples I found, which is the pattern I'm following, I believe the dependencies were also SBT projects. The elasticsearch-hadoop library is a java project built with gradle that has a scala project embedded within, the Spark part, and clearly the whole thing is not built with SBT.
So I'm not sure if I've even imported the project, although I might have, and I'm also not sure if those class exclusions are working. I'm hoping somebody can shed some light?
Upvotes: 1
Views: 123
Reputation: 170795
AFAIK, this isn't allowed: SBT can only import dependencies via Git which are themselves built with SBT. You can publish it to your local repository and depend on it using libraryDependencies
as usual. The only problem is that if you make changes in the dependency you have to republish it.
Upvotes: 1