源码编译以及测试工程创建


软件准备

  • shc源码包
    下载地址:https://github.com/hortonworks-spark/shc/releases


1. 编译源码包

(1) 解压源码包,修改项目根目录下的pom文件

根据自己使用的版本修改各组件的版本号,以下是我修改后的pom文件:

<groupId>com.hortonworks</groupId>
<artifactId>shc</artifactId>
<version>spark-2.3.0-hbase-1.2.6</version>
<packaging>pom</packaging><properties><spark.version>2.3.0</spark.version><hbase.version>1.2.6</hbase.version><phoenix.version>4.14.0-HBase-1.2</phoenix.version><java.version>1.8</java.version>
</properties>

说明:

  • 以上内容只是我修改的部分,没有修改的我没有贴出来
  • 我修改了version,那么在子模块的pom中,也要修改为一样的version

以下是我修改后的两个子模块core和examples中的pom文件,只修改了version

<parent><groupId>com.hortonworks</groupId><artifactId>shc</artifactId><version>spark-2.3.0-hbase-1.2.6</version><relativePath>../pom.xml</relativePath>
</parent><artifactId>shc-core</artifactId>
<version>spark-2.3.0-hbase-1.2.6</version>
<packaging>jar</packaging>
<name>HBase Spark Connector Project Core</name><parent><groupId>com.hortonworks</groupId><artifactId>shc</artifactId><version>spark-2.3.0-hbase-1.2.6</version><relativePath>../pom.xml</relativePath>
</parent><artifactId>shc-examples</artifactId>
<version>spark-2.3.0-hbase-1.2.6</version>
<packaging>jar</packaging>
<name>HBase Spark Connector Project Examples</name>

(2) 编译源码

在源码包根目录下执行mvn命令:

mvn install -DskipTests

执行成功后,你的本地maven仓库中已经有了这个项目的jar包

2. 创建测试shc的maven工程

(1) 新建maven工程,在pom中引入我们编译好的shc-core的依赖

注意,我们只需要shc-core的依赖

<dependency><groupId>com.hortonworks</groupId><artifactId>shc-core</artifactId><version>spark-2.3.0-hbase-1.2.6</version>
</dependency>

(2) 导入spark相关的依赖,并解决依赖冲突

# 以下spark的依赖包排除了hadoop-client包,因为与shc-core中的hadoop-client有版本冲突<dependency><groupId>org.apache.spark</groupId><artifactId>spark-core_2.11</artifactId><version>2.3.0</version><exclusions><exclusion><groupId>org.apache.hadoop</groupId><artifactId>hadoop-client</artifactId></exclusion></exclusions>
</dependency><dependency><groupId>org.apache.spark</groupId><artifactId>spark-sql_2.11</artifactId><version>2.3.0</version><exclusions><exclusion><groupId>org.apache.hadoop</groupId><artifactId>hadoop-client</artifactId></exclusion></exclusions>
</dependency><dependency><groupId>org.apache.spark</groupId><artifactId>spark-streaming_2.11</artifactId><version>2.3.0</version><exclusions><exclusion><groupId>org.apache.hadoop</groupId><artifactId>hadoop-client</artifactId></exclusion></exclusions>
</dependency><dependency><groupId>org.apache.spark</groupId><artifactId>spark-streaming-kafka-0-10_2.11</artifactId><version>2.3.0</version>
</dependency># 手动引入hadoop-client的依赖
<dependency><groupId>org.apache.hadoop</groupId><artifactId>hadoop-client</artifactId><version>2.7.6</version>
</dependency>

这里选择引入hadoop2.7.6版本的hadoop-client是因为2.7版本的hadoop可以兼容全部版本的hbase,下图为hbase官网的hadoop与hbase各版本的兼容性对照表:

(3) 引入hbase相关的依赖并解决依赖冲突

这里只需要排除掉冲突的依赖就可以了

<dependency><groupId>org.apache.hbase</groupId><artifactId>hbase-client</artifactId><version>1.2.6</version><exclusions><exclusion><groupId>org.apache.hadoop</groupId><artifactId>hadoop-auth</artifactId></exclusion><exclusion><groupId>org.apache.hadoop</groupId><artifactId>hadoop-common</artifactId></exclusion><exclusion><groupId>org.apache.hadoop</groupId><artifactId>hadoop-mapreduce-client-core</artifactId></exclusion><exclusion><groupId>io.netty</groupId><artifactId>netty-all</artifactId></exclusion></exclusions>
</dependency><dependency><groupId>org.apache.hbase</groupId><artifactId>hbase-server</artifactId><version>1.2.6</version><exclusions><exclusion><groupId>io.netty</groupId><artifactId>netty-all</artifactId></exclusion></exclusions>
</dependency>

(4) 把hdfs-site.xml、core-site.xml和hbase-site.xml放到项目的resources目录下

(5) 其他

  • 我在ideal中创建的这个maven工程,加入了scala-sdk,不再赘述
  • 修改了项目架构,加入了scala主程序文件夹和测试文件夹

  • 配置了maven相关的插件,加入了scala编译插件
<build><plugins><plugin><groupId>net.alchim31.maven</groupId><artifactId>scala-maven-plugin</artifactId><version>3.4.2</version><executions><execution><id>scala-compile-first</id><phase>process-resources</phase><goals><goal>add-source</goal><goal>compile</goal></goals></execution></executions><configuration><scalaVersion>2.11.8</scalaVersion><recompileMode>incremental</recompileMode><useZincServer>true</useZincServer><args><arg>-unchecked</arg><arg>-deprecation</arg><arg>-feature</arg></args><javacArgs><javacArg>-source</javacArg><javacArg>1.8</javacArg><javacArg>-target</javacArg><javacArg>1.8</javacArg></javacArgs></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.8.0</version><executions><execution><phase>compile</phase><goals><goal>compile</goal></goals></execution></executions><configuration><skip>true</skip><source>1.8</source><target>1.8</target><encoding>UTF-8</encoding></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><version>3.1.0</version><configuration><encoding>UTF-8</encoding></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-shade-plugin</artifactId><version>3.1.1</version><executions><execution><phase>package</phase><goals><goal>shade</goal></goals><configuration><!-- 设置jar包的主类 --><!--<transformers><transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"><mainClass>com.bonc.rdpe.spark.hbase.SparkToHBase</mainClass></transformer></transformers>--><filters><filter><artifact>*:*</artifact><excludes><exclude>META-INF/*.SF</exclude><exclude>META-INF/*.DSA</exclude><exclude>META-INF/*.RSA</exclude></excludes></filter></filters></configuration></execution></executions></plugin></plugins>
</build>

至此,开始测试shc之前的全部准备工作就做好了!

转自:CoderJed

https://www.jianshu.com/p/ab09eb36b32a

Hortonworks的开源框架SHC的使用(一)相关推荐

  1. 大数据开源框架技术汇总

    主要基于对现阶段一些常用的大数据开源框架技术的整理,只是一些简单的介绍,并不是详细技术梳理.可能会有疏漏,发现再整理.参考得太多,就不一一列出来了.这只是作为一个梳理,对以后选型或者扩展的做个参考. ...

  2. Farseer.net轻量级ORM开源框架 V1.x 入门篇:新版本说明

    导航 目   录:Farseer.net轻量级ORM开源框架 目录 上一篇:没有了 下一篇:Farseer.net轻量级ORM开源框架 V1.x 入门篇:数据库配置 前言 V1.x版本终于到来了.本次 ...

  3. tomcat中request对象是被创建的_常用开源框架中设计模式使用分析(全)

    一.前言 说起来设计模式,大家应该都耳熟能详,设计模式代表了软件设计的最佳实践,是经过不断总结提炼出来的代码设计经验的分类总结,这些模式或者可以简化代码,或者可以是代码逻辑开起来清晰,或者对功能扩展很 ...

  4. 分布式计算开源框架Hadoop入门实践

    在SIP项目设计的过程中,对于它庞大的日志在开始时就考虑使用任务分解的多线程处理模式来分析统计,在我从前写的文章<Tiger Concurrent Practice --日志分析并行分解设计与实 ...

  5. python后端学什么框架_献给正在学习python的你, 10个最受欢迎的Python开源框架

    很多小伙伴在学习wen的时候说,有没有几个常用的框架,好多小伙伴都只说对了其中几个,只有少部分是说正确的,想要了解更多,欢迎大家订阅微信公众号:Python从程序猿到程序员,或者加4913.08659 ...

  6. 发布开源框架到CocoaPods入坑指南

    个人原文博客地址: 发布开源框架到CocoaPods入坑指南 在开发过程中一定会用到一些第三方框架, 只要安装了CocoaPods, 然后通过pod install命令, 就可以集成框架到项目中了 可 ...

  7. Android_开源框架_Volley实例

    2019独角兽企业重金招聘Python工程师标准>>> 1.自定义相关类 在 Android_开源框架_Volley(Google IO 2013)源代码及内部实现过程分析一文中,简 ...

  8. 百度飞桨全新升级:重磅推出PaddleHelix平台、开源框架V2.0RC,硬件生态路线图全公开...

    12月20日,WAVE SUMMIT+2020深度学习开发者峰会在北京举办.本届峰会,百度飞桨带来八大全新发布与升级,有支持前沿技术探索和应用的生物计算平台PaddleHelix螺旋桨,开发更加便捷的 ...

  9. 2020,国产AI开源框架“亮剑”TensorFlow、PyTorch

    「AI技术生态论」 人物访谈栏目是CSDN发起的百万人学AI倡议下的重要组成部分.通过对AI生态专家.创业者.行业KOL的访谈,反映其对于行业的思考.未来趋势的判断.技术的实践,以及成长的经历. 20 ...

  10. 再见Spring!下一个开源框架更香!

    在MyBatis 3.5.1这个版中有968个类.2770个字段.8422个方法.42504行代码.186428个指令码.其源码体量只有Spring 的1/5,也是Hibernate的1/5. 但在功 ...

最新文章

  1. CentOS 6.8 安装最新版 Git
  2. minio分布式集群示例: 4节点,每节点4块盘
  3. springboot中配置mybatis数据源,使用阿里的 Druid 数据库连接池
  4. mysql 多个实例 备份_Linux下安装Mysql多实例作为数据备份服务器实现多主到一从多实例的备份...
  5. 从报表到数据可视化,我用这五步,成功搭建银行大数据架构
  6. Ext中extend
  7. R语言maps包绘制世界地图并存为矢量图 超基础!
  8. Moodle 3.7安装
  9. 前端常用布局大全——细致讲解
  10. java 设置压缩文件大小不变_为什么把文件压缩后,文件大小却不变呢?
  11. ROS中使用protoBuf通信
  12. python读书心得体会范文_个人读书心得体会范文五篇
  13. Mysql 不使用窗口函数实现分组排序 rank 别名问题
  14. 阿里巴巴java开发规范手册
  15. 《寻寻觅觅错误无处找?教你如何快速寻找程序错误(必看)》
  16. wParam和lParam参数
  17. Android Studio Chipmunk | 2021.2.1 JNI
  18. 13道字符串笔试题及答案,总有一道你面试会遇上
  19. 分享116个JS图片代码,总有一款适合您
  20. C语言的模糊查询,【C语言如何实现中文模糊查询+急+】

热门文章

  1. Excel 中 IRR 函数
  2. 支持linux的蓝牙键盘,可连接四款蓝牙设备的机械键盘 功能强大 不容小觑
  3. excel小写转大写公式_英文字母大小写的转换
  4. 计算机打开查看方式默认是什么样,win10图片打开方式里没有默认照片查看器的解决方法...
  5. 一看就会的侧方位停车技巧 见了就收了吧
  6. Pysyft学习笔记
  7. 数据分析学习笔记--航空公司客户价值分析(代码)
  8. 创业维艰:为啥大多数创业者都不开心?
  9. 科普下Tippy.js - 开源且高度可做空间php的气泡翻译器
  10. matlab调整文字方向,python 旋转文字方向_如何通过Python 在绘图中旋转文字?