我尝试按照此instruction使IntelliJ与provided
和compile
依赖关系很好玩。但是,我无法获取子模块来读取其父变量。这是我的root build.sbt
name := "vivace"
version := "1.0"
scalaVersion := "2.11.8"
val sparkVersion = "2.1.0"
val hadoopVersion = "2.7.3"
val awsVersion = "1.11.155"
lazy val sparkAndDependencies = Seq(
"org.apache.spark" %% "spark-core" % sparkVersion,
"org.apache.spark" %% "spark-sql" % sparkVersion,
"org.apache.spark" %% "spark-hive" % sparkVersion,
"org.apache.spark" %% "spark-streaming" % sparkVersion,
"org.apache.hadoop" % "hadoop-aws" % hadoopVersion,
"org.apache.hadoop" % "hadoop-common" % hadoopVersion
)
libraryDependencies ++= sparkAndDependencies.map(_ % "provided")
libraryDependencies += "com.cn" %% "sparrow-clf-parser" % "1.1-SNAPSHOT"
libraryDependencies += "com.amazonaws" % "aws-java-sdk" % awsVersion
libraryDependencies += "com.amazonaws" % "aws-java-sdk-s3" % awsVersion
libraryDependencies += "com.amazonaws" % "aws-java-sdk-core" % awsVersion
libraryDependencies += "com.github.seratch" %% "awscala" % "0.6.+"
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.6.0"
dependencyOverrides ++= Set("com.fasterxml.jackson.core" % "jackson-databind" % "2.6.0")
assemblyMergeStrategy in assembly := {
case PathList("org","aopalliance", xs @ _*) => MergeStrategy.last
case PathList("javax", "inject", xs @ _*) => MergeStrategy.last
case PathList("javax", "servlet", xs @ _*) => MergeStrategy.last
case PathList("javax", "activation", xs @ _*) => MergeStrategy.last
case PathList("org", "apache", xs @ _*) => MergeStrategy.last
case PathList("com", "google", xs @ _*) => MergeStrategy.last
case PathList("com", "esotericsoftware", xs @ _*) => MergeStrategy.last
case PathList("com", "codahale", xs @ _*) => MergeStrategy.last
case PathList("com", "yammer", xs @ _*) => MergeStrategy.last
case PathList("com", "amazonaws", xs @ _*) => MergeStrategy.last
case PathList("com", "typesafe", xs @ _*) => MergeStrategy.last
case "about.html" => MergeStrategy.rename
case "META-INF/ECLIPSEF.RSA" => MergeStrategy.last
case "META-INF/mailcap" => MergeStrategy.last
case "META-INF/mimetypes.default" => MergeStrategy.last
case "plugin.properties" => MergeStrategy.last
case "log4j.properties" => MergeStrategy.last
case "overview.html" => MergeStrategy.last
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
这是我的子模块build.sbt mainRunner/sbt.build
scalaVersion := "2.11.8"
lazy val mainRunner = project.in(file("mainRunner")).dependsOn(RootProject(file("."))).settings(
libraryDependencies ++= sparkAndDependencies.map(_ % "compile")
)
这是我得到的错误
错误:导入SBT项目时出错:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0 [info] Loading project definition from /Users/ncharass/MyProjects/CN/vivace/mainRunner/project /Users/ncharass/MyProjects/CN/vivace/mainRunner/build.sbt:4: error: not found: value sparkAndDependencies libraryDependencies ++= sparkAndDependencies.map(_ % "compile") ^ sbt.compiler.EvalException: Type error in expression [error] sbt.compiler.EvalException: Type error in expression [error] Use 'last' for the full log.