sbt依赖冲突查看及解决

2018-02-28  本文已影响1417人  zlcook

安装依赖关系解析插件

graph_importer项目中使用依赖

项目scala版本:scalaVersion := "2.11.11"

libraryDependencies ++= Seq(
  "org.apache.spark" %% "spark-core" % "1.6.2",
  "org.apache.spark" %% "spark-sql" % "1.6.2",
  "com.databricks" %% "spark-csv" % "1.5.0",
  "commons-cli" % "commons-cli" % "1.4",
  "org.janusgraph" % "janusgraph-all" % "0.2.0" exclude("org.apache.hadoop","hadoop-common") exclude("com.sleepycat","je"),
  "org.apache.hadoop" % "hadoop-common" % "2.7.2" exclude("javax.servlet", "servlet-api"),
  "org.apache.hbase" % "hbase-shaded-client" % "1.2.6",
  "com.alibaba" % "fastjson" % "1.2.39"
)

问题

[error] Modules were resolved with conflicting cross-version suffixes in {file:/Users/xiangzuqi/dev/idea_workspace/graph/}graph_importer:
[error]    org.apache.spark:spark-launcher _2.11, _2.10
[error]    org.json4s:json4s-ast _2.11, _2.10
[error]    org.apache.spark:spark-network-shuffle _2.11, _2.10
[error]    com.typesafe.akka:akka-actor _2.11, _2.10
[error]    com.twitter:chill _2.11, _2.10
[error]    org.json4s:json4s-jackson _2.11, _2.10
[error]    com.fasterxml.jackson.module:jackson-module-scala _2.11, _2.10
[error]    org.json4s:json4s-core _2.11, _2.10
[error]    org.apache.spark:spark-unsafe _2.11, _2.10
[error]    com.typesafe.akka:akka-remote _2.11, _2.10
[error]    com.typesafe.akka:akka-slf4j _2.11, _2.10
[error]    org.apache.spark:spark-core _2.11, _2.10
[error]    org.apache.spark:spark-network-common _2.11, _2.10
[trace] Stack trace suppressed: run last graph_importer/*:update for the full output.

查找冲突依赖

image.png

确定冲突依赖在哪里引进来的

[info] org.apache.spark:spark-core_2.10:1.6.1
[info] org.apache.spark:spark-core_2.11:1.6.2

查询org.apache.spark:spark-core_2.10:1.6.1依赖图

 sbt whatDependsOn org.apache.spark spark-core_2.10 1.6.1
[info] org.apache.spark:spark-core_2.10:1.6.1
[info]   +-org.apache.tinkerpop:spark-gremlin:3.2.6 [S]
[info]     +-org.janusgraph:janusgraph-hadoop:0.2.0
[info]       +-org.janusgraph:janusgraph-all:0.2.0
[info]         +-com.jd.jr:graph_importer_2.11:1.0-fc49bb9d409f43dcd03e317471..
[info]

查询org.apache.spark:spark-core_2.11:1.6.2依赖图

image.png

冲突结论

重新编译打包spark-gremlin

git clone https://github.com/apache/tinkerpop.git
git checkout 3.2.6
git checkout -b tinkerpop3.2.6
tinkerpop

让graph_importer下载本地maven仓库中定制的spark-gremlin

repositories文件

[repositories]
  maven-local
  local
  //typesafe-releases: http://repo.typesafe.com/typesafe/releases
  typesafe-ivy-releasez: http://repo.typesafe.com/typesafe/ivy-releases, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]

先删掉sbt本地仓库中的sprk-gremlin:3.2.6

查看sbt仓库解析器

> show fullResolvers
[info] * Raw(ProjectResolver(inter-project, mapped: ))
[info] * FileRepository(local,FileConfiguration(true,None),Patterns(ivyPatterns=List(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=List(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false))
[info] * cache:Maven2 Local: C:\Users\zhouliang6\.m2\repository
[info] * my-maven-proxy-releases: http://10.13.96.74:8081/artifactory/libs-release
[info] * URLRepository(my-ivy-proxy-releases,Patterns(ivyPatterns=List(http://10.13.96.74:8081/artifactory/sbt-release/[organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=List(http://10.13.96.74:8081/artifactory/sbt-release/[organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false))

执行sbt update

上一篇 下一篇

猜你喜欢

热点阅读