为Spark创建JAR

时间:2016-02-10 14:48:56

标签: java scala apache-spark sbt distributed-computing

我正在关注此guide,但当我尝试使用 sbt 创建JAR时,我无法在Spark中运行Scala。

我有 simple.sbt

name := "Simple Project"
version := "1.0"
scalaVersion := "2.10.4"
libraryDependencies += "org.apache.spark" % "spark-core_2.10" % "1.6.0"

这是错误:

sbt package
[INFO]  ..
[warn]  [NOT FOUND  ] org.eclipse.jetty.orbit#javax.servlet;3.0.0.v201112011016!javax.servlet.orbit (255ms)
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/eclipse/jetty/orbit/javax.servlet/3.0.0.v201112011016/javax.servlet-3.0.0.v201112011016.orbit
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::              FAILED DOWNLOADS            ::
[warn]  :: ^ see resolution messages for details  ^ ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.eclipse.jetty.orbit#javax.servlet;3.0.0.v201112011016!javax.servlet.orbit
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/home/gsamaras/spark-1.6.0-bin-hadoop2.6/code/}default-04a409/*:update: sbt.ResolveException: download failed: org.eclipse.jetty.orbit#javax.servlet;3.0.0.v201112011016!javax.servlet.orbit
[error] Total time: 25 s, completed Feb 10, 2016 5:11:30 PM

Scala版本,但我在某处阅读它无关紧要:

gsamaras@gsamaras:~/spark-1.6.0-bin-hadoop2.6/code$ scala -version
Scala code runner version 2.11.6 -- Copyright 2002-2013, LAMP/EPFL

和sbt版本:

gsamaras@gsamaras:~/spark-1.6.0-bin-hadoop2.6/code$ sbt sbt-version
[info] Set current project to Simple Project (in build file:/home/gsamaras/spark-1.6.0-bin-hadoop2.6/code/)
[info] 0.11.3

相关:SBT, Jetty and Servlet 3.0

1 个答案:

答案 0 :(得分:1)

通过执行将 sbt 更新到最新版本(某些步骤可能是可选的):

sudo apt-get remove sbt
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823
sudo apt-get update
sudo apt-get install sbt
sudo apt-get upgrade sbt

你会没事的。