加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Sbt 排除依赖冲突详细解析

发布时间:2020-12-14 04:30:38 所属栏目:百科 来源:网络整理
导读:1.Sbt 依赖树 参考: dependencyGraph sbt plugin https://github.com/jrudolph/sbt-dependency-graph 安装插件 建立文件:./.sbt/1.0/plugins/plugins.sbt 添加内容:addSbtPlugin(“net.virtual-void” % “sbt-dependency-graph” % “0.9.0”) 插件启动

1.Sbt 依赖树

参考:
dependencyGraph sbt plugin
https://github.com/jrudolph/sbt-dependency-graph

安装插件
建立文件:./.sbt/1.0/plugins/plugins.sbt
添加内容:addSbtPlugin(“net.virtual-void” % “sbt-dependency-graph” % “0.9.0”)

插件启动
sbt:graphPlatform> dependencyTree
其他命令:https://github.com/jrudolph/sbt-dependency-graph#main-tasks

问题:
项目中要的是hbase1.2.6版本的包,确出现了hbase1.1.1,原因是hive-jdbc和hive-cli间接依赖hbase1.1.1
sbt的依赖包如下所示:

"org.apache.hbase" % "hbase-client" % "1.2.6","org.apache.hbase" % "hbase-common" % "1.2.6","org.apache.hbase" % "hbase-server" % "1.2.6","org.apache.hbase" % "hbase-protocol" % "1.2.6","org.apache.hive" % "hive-jdbc" % "2.3.2","org.apache.hive" % "hive-cli" % "2.3.2",

项目中依赖截图如下所示:
idea–>File–>Project Structure–>Libraries

解决依赖:
1)使用依赖树:sbt->project project_name->dependencyTree
2)查看相互依赖:sbt->project project_name->whatDependsOn org.apache.hbase hbase-annotations 1.1.1

依赖从下往上看“com.jd.jr:graph_importer_2.11:1.0-SNAPSHOT”依赖–>“org.apache.hive:hive-cli:2.3.2”依赖–>“org.apache.hive:hive-service:2.3.2”依赖–>“org.apache.hive:hive-llap-server:2.3.2”依赖–>“org.apache.hbase:hbase-server:1.1.1”

找到问题了,需要在“org.apache.hive:hive-cli:2.3.2”排除“org.apache.hbase:hbase-server:1.1.1”

sbt:graph_importer> whatDependsOn org.apache.hbase hbase-server 1.1.1
[info] org.apache.hbase:hbase-server:1.1.1 (evicted by: 1.2.6)
[info]   +-com.jd.jr:graph_importer_2.11:1.0-SNAPSHOT [S]
[info]   +-org.apache.hive:hive-llap-server:2.3.2
[info]     +-org.apache.hive:hive-service:2.3.2
[info]       +-org.apache.hive:hive-cli:2.3.2
[info]       | +-com.jd.jr:graph_importer_2.11:1.0-SNAPSHOT [S]
[info]       |
[info]       +-org.apache.hive:hive-jdbc:2.3.2
[info]         +-com.jd.jr:graph_importer_2.11:1.0-SNAPSHOT [S]
[info]

3)其余三个不需要的Jar包参考第二步
sbt依赖的处理后展示

"org.apache.hbase" % "hbase-client" % "1.2.6","org.apache.hive" % "hive-jdbc" % "2.3.2"
    exclude("org.apache.hbase","hbase-protocol")
    exclude("org.apache.hbase","hbase-client")
    exclude("org.apache.hbase","hbase-common")
    exclude("org.apache.hbase","hbase-service"),"org.apache.hive" % "hive-cli" % "2.3.2"
    exclude("org.apache.hbase",

4)sbt中先“clean”再“compile”.(其中compile包括了update)
项目中依赖截图如下所示:

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读