Windows使用Idea编译spark源码
1. 环境准备
JDK1.8
Scala2.11.8
Maven 3.3+
IDEA with scala plugin
2. 下载spark源码
下载地址 https://archive.apache.org/dist/spark/spark-2.0.0/spark-2.0.0.tgz
将下载好的spark源码解压到c:\workspace
3. Idea 导入spark-2.0.0源码工程






一路next下去,最后点击finish。

最后,进行项目的编译

4. 可能遇到的问题
4.1 not found: type SparkFlumeProtocol
spark\external\flume-sink\src\main\scala\org\apache\spark\streaming\flume\sink\SparkAvroCallbackHandler.scala
Error:(, ) not found: type SparkFlumeProtocol
解决方案:

选中Spark Project External Flume Sink,并右键点击Generate Sources and Update Folders. 然后重新编译应该就会消失。
4.2 Error:(34, 45) object SqlBaseParser is not a member of package org.apache.spark.sql.catalyst.parser
\spark\sql\catalyst\src\main\scala\org\apache\spark\sql\catalyst\parser\AstBuilder.scala
Error:(, ) object SqlBaseParser is not a member of package org.apache.spark.sql.catalyst.parser
import org.apache.spark.sql.catalyst.parser.SqlBaseParser._
解决方案:

选中Spark Project External Catalyst,并右键点击Generate Sources and Update Folders. 然后重新编译应该就会消失.
4.3 Error:(52, 75) not found: value TCLIService
spark\sql\hive-thriftserver\src\main\java\org\apache\hive\service\cli\thrift\ThriftCLIService.java
Error:(, ) not found: value TCLIService
public abstract class ThriftCLIService extends AbstractService implements TCLIService.Iface, Runnable {………..

一般来讲,这几个问题解决之后,编译就会成功。

5. gitBash中进行编译
为什么使用gitbash,因为在idea中编译时会出现各种各种的报错,gitbash中拥有一些idea中没有的环境。可能出现如下错误,使用gitbash即可解决
使用gitbash进入项目的根目录下,执行下面3条命令
cd /c/Workspace/spark-2.0.0
export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512m"
./build/mvn -Pyarn -Phadoop-2.7 -Dhadoop.version=2.7. -DskipTests clean package

最后编译出来的结果如下:

参考:
https://blog.csdn.net/make__It/article/details/84258916
http://dengfengli.com/blog/how-to-run-and-debug-spark-source-code-locally/
Windows使用Idea编译spark源码的更多相关文章
- 编译spark源码及塔建源码阅读环境
编译spark源码及塔建源码阅读环境 (一),编译spark源码 1,更换maven的下载镜像: <mirrors> <!-- 阿里云仓库 --> <mirror> ...
- Spark 学习(三) maven 编译spark 源码
spark 源码编译 scala 版本2.11.4 os:ubuntu 14.04 64位 memery 3G spark :1.1.0 下载源码后解压 1 准备环境,安装jdk和scala,具体参考 ...
- Spark笔记--使用Maven编译Spark源码(windows)
1. 官网下载源码 source code,地址: http://spark.apache.org/downloads.html 2. 使用maven编译: 注意在编译之前,需要设置java堆大小以及 ...
- Windows环境编译Spark源码
一.下载源码包 1. 下载地址有官网和github: http://spark.apache.org/downloads.html https://github.com/apache/spark Li ...
- 编译Spark源码
Spark编译有两种处理方式,第一种是通过SBT,第二种是通过Maven.作过Java工作的一般对于Maven工具会比较熟悉,这边也是选用Maven的方式来处理Spark源码编译工作. 在开始编译工作 ...
- window环境下使用sbt编译spark源码
前些天用maven编译打包spark,搞得焦头烂额的,各种错误,层出不穷,想想也是醉了,于是乎,换种方式,使用sbt编译,看看人品如何! 首先,从官网spark官网下载spark源码包,解压出来.我这 ...
- Spark—编译Spark源码
Spark版本:Spark-2.1.0 Hadoop版本:hadooop-2.6.0-cdh5.7.0 官方文档:http://spark.apache.org/docs/latest/buildin ...
- windows使用VS编译python源码
使用VS2021编译python源码 说明,使用VS2019也是可以的. 环境准备 对于VS2019首要要安装必要的环境 到python官网下载源码压缩包以及解压(红色箭头任选一个都行) 打开下载好的 ...
- Windows 用VS编译libevent源码
原理:从github上克隆libevent源码,然后使用cmake生成VS工程 github 上 libevent项目地址:https://github.com/libevent/libevent 第 ...
随机推荐
- Using pointer to access array instead of index
See example below firstly. uint8_t parity = ; uint8_t index = ; //flag gMUXTask.responseData[index++ ...
- Unity 资源的优化管理 学习
- TP5一对一、一对多关联模型的使用
文章表SQL CREATE TABLE `tp_article` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID', `title` varc ...
- 【转】Python metaclass
转自: http://ju.outofmemory.cn/entry/32434 在回答了 yield关键字和 decorator的问题之后,我更明白了,我决定非常详细地回答这个问题. 读前警告:这个 ...
- [转]在Eclipse中搭建Python开发环境
在Eclipse中搭建Python开发环境 来自: http://hi.baidu.com/hqwfreefly/blog/item/2543181d0afd9604314e150e.html 前言 ...
- MyEclipse+Tomcat配置
一.Tomcat 1 Tomcat概述 Tomcat服务器由Apache提供,开源免费.由于Sun和其他公司参与到了Tomcat的开发中,所以最新的JSP/Servlet规范总是能在Tomcat中体现 ...
- JAVA开源B2C系统
前言 最近有人想面向境外销售商品,但是又不想依托于亚马逊这些平台,于是找我来帮忙想弄个B2C系统.因为刚开始只是打算试试水,也就不打算投入多少成本了.所以这边就考虑使用开源的B2C系统来直接使用了. ...
- Git将本地库内容推送到远程
本地库与远程库的交互 1 .将本地库的内容推送到远程库 A.创建一个本地仓库 $ mkdir gitdemo B.初始化本地仓库 $ git init C.项目根目录下创建 .gitignore 文件 ...
- windows下怎么生成github的ssh公钥
windows下如何生成github的ssh公钥: 1.首先你要安装Git工具 2.在C:\Documents and Settings\Administrator\目录下,运行Git Bash he ...
- Windows 使用windump进行循环抓包
准备工作 1.下载tcpdump http://www.winpcap.org/windump/ 2.下载WinPcaphttp://www.winpcap.org/install/bin/WinP ...