我使用sbt
来构建我的Scala项目。
这是我的build.sbt
文件:
name := "SpatialSpark"
version := "1.0"
scalaVersion := "2.10.4"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.2.1"
libraryDependencies += "com.vividsolutions" % "jts" % "1.13"
然后我尝试将它打包到jar中。 sbt package
最后,我将其提交给Apache-Spark
,
spark-submit --class "com.chen.spatial.SpatialApp" --master local[4] target/scala-2.10/spatialspark_2.10-1.0.jar
导致 NoClassDefFoundError 错误,
Exception in thread "main" java.lang.NoClassDefFoundError: com/vividsolutions/jts/index/strtree/STRtree
将它装入罐子时,我有没有想念?
答案 0 :(得分:1)
答案 1 :(得分:1)
请查看此模板项目:
https://github.com/spektom/spark-scala-template
建立uberjar运行:
var http = new Http(..)
在Spark中运行Jar:
sbt assembly