用Eclipse构建Spark源代码调试阅读环境

来源:互联网 发布:潍柴动力网络测评答案 编辑:程序博客网 时间:2024/06/05 16:51

实验环境准备:

JDK Java 语言的软件开发工具包(SDK)

参考网址: http://www.oracle.com/technetwork/java/javase/downloads/index.html

SaclaIDE一个基于Eclipse开发的Scala的集成开发软件。(可直接用)

参考网址:http://scala-ide.org/

ScalaSpark是用Scala语言写成的,在本地编译执行需要这个包

参考网址:http://www.scala-lang.org/download/

SBTscala工程构建的工具

参考网址:http://www.scala-sbt.org/download.html

操作系统:windows7

 

注解(附件详细补充):可以先直接在官网下载Eclipse软件,之后可以在插件中找到Scala插件,也行,详细方案请参看最后后面的附件(纯Eclipse自己安装Scala插件的集成开发环境的构建)。

参考网址:http://www.eclipse.org/downloads/

 

第一部分、软件安装

1、  安装JDK (版本为1.7.0_11)

2、  安装Scala (版本为2.11.2)

3、  安装ScalaIDE(版本为3.0.4)

 

第二部分:加压缩官网下载的源代码包或者找到通过Git抽取的Spark源文件:

         我用的是spark-1.1.1版本(最新版本),由于idea 13已经原生支持sbt,所以无须为idea安装sbt插件。

源码下载(用git工具):

# Masterdevelopment branch

gitclone git://github.com/apache/spark.git

# 1.1 maintenancebranch with stability fixes on top of Spark 1.1.1

gitclone git://github.com/apache/spark.git -b branch-1.1

源码更新(用git工具同步跟新源码):

gitclone https://github.com/apache/spark.git

 

第三部分:通过sbt工具,构建Scala的Eclipse工程,详细步骤如下所示

1、通过cmd命令进入DOS界面,之后通过cd命令进入源代码项目中,我下载的Spark.1.1.1版本的源代码放在(E:\Spark计算框架的研究\spark_1_1_1_eclipse)文件夹中,之后运行sbt命令,如下所示:


2、运行sbt命令之后,解析编译相关的jar包,并出现sbt命令界面窗口,出现的效果图如下所示,之后运行eclipse命令,sbt对这个工程进行编译,构建Eclipse项目,效果图如下所示:

 

4、  打开ScalaIDE工具,File à Import à Existing Projects into Workspace à Next à 选择刚好用sbt工具编译好的Eclipse工程(E:\Spark计算框架的研究\spark_1_1_1_eclipse),如下图所示。


5、  通过上面的操作,就可以将通过sbt工具编译生成的Eclipse项目导入到EclipseIDE开发环境中,效果图如下所示:


错误提示如下所示:我导入的包为,如下文件夹中所示。

(E:\Spark计算框架的研究\spark_1_1_1_eclipse\lib_managed\bundles)

Description      Resource Path Location   Type

akka-remote_2.10-2.2.3-shaded-protobuf.jar is cross-compiled

with an incompatible version of Scala (2.10).

In case of errorneous report, this check can be disabled

in the compiler preference page.   

spark-core                 Unknown Scala Classpath Problem

 

Description      Resource Path Location   Type

akka-slf4j_2.10-2.2.3-shaded-protobuf.jar is cross-compiled with

an incompatible version of Scala (2.10). In case of errorneous report,

this check can be disabled in the compiler preference page.

spark-core                 Unknown Scala Classpath Problem

 

Description      Resource Path Location   Type

akka-testkit_2.10-2.2.3-shaded-protobuf.jar is cross-compiled

with an incompatible version of Scala (2.10).

In case of errorneous report, this check can be disabled in the compiler preference page.

spark-core                 Unknown Scala Classpath Problem

 

Description      Resource Path Location   Type

akka-zeromq_2.10-2.2.3-shaded-protobuf.jar is cross-compiled

with an incompatible version of Scala (2.10).

In case of errorneous report, this check can be disabled in the compiler preference page. 

spark-core                 Unknown Scala Classpath Problem

上面这些包兼容性问题还没有解决,修改相应的jar包就可以解决。

 

 

 

阅读全文
0 0
原创粉丝点击