目前,在AWS EMR集群中,我正在使用Sparkv2.4.5
,它随Scalav2.11
一起提供。所以在我的项目中,我想使用Scala v2.11和相应的SBT
和Sbt-汇编
版本。但我得到一个或其他版本冲突与各种博客和Stackoverflow答案上提供的所有排列。
以下是引发错误的依赖项文件:
建筑sbt
name := "user-view-services"
version := "0.1"
scalaVersion := "2.11.12"
autoScalaLibrary := false
// Major Libraries version
val sparkVersion = "2.4.5"
val kafkaVersion = "2.5.0"
val akkaVersion = "2.6.4"
val confluentRepo = "confluent-repo" at "https://packages.confluent.io/maven/"
lazy val commonDependencies = Seq(
"junit" % "junit" % "4.13" % Test,
"org.mockito" % "mockito-all" % "1.10.19" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test,
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.typesafe" % "config" % "1.4.0",
"com.opencsv" % "opencsv" % "5.1",
"org.apache.avro" % "avro" % "1.9.2",
"commons-beanutils" % "commons-beanutils" % "1.9.4",
"commons-beanutils" % "commons-beanutils-bean-collections" % "1.8.3",
"org.drools" % "drools-compiler" % "7.41.0.Final",
"com.typesafe.scala-logging" % "scala-logging_2.11" % "3.5.0"
)
lazy val mongoDBDependencies = Seq(
"org.mongodb" % "mongodb-driver-sync" % "4.0.2"
)
lazy val akkaDependencies = Seq(
"com.typesafe.akka" %% "akka-actor-typed" % akkaVersion
)
lazy val kafkaDependencies = Seq(
"org.apache.kafka" % "kafka-clients" % kafkaVersion,
"org.apache.kafka" % "kafka-streams" % kafkaVersion,
"io.confluent" % "kafka-avro-serializer" % "5.4.1"
)
lazy val sparkDependencies = Seq(
"org.apache.spark" %% "spark-core" % sparkVersion,
"org.apache.spark" %% "spark-sql" % sparkVersion,
"org.apache.spark" %% "spark-streaming" % sparkVersion
)
lazy val rulemodule = (project in file("rule-module"))
.enablePlugins(JavaAppPackaging)
.settings(
name := "rule-module",
version := "1.0",
libraryDependencies ++= commonDependencies
)
/**
* to create uberjar - run command
* 1) sbt "sparkjobs / clean"
* 2) sbt "sparkjobs / assembly"
*/
lazy val sparkjobs = (project in file("user-enrich-batch"))
.dependsOn(rulemodule)
.settings(
name := "user-enrich-batch",
version := "1.0",
resolvers ++= Seq(
confluentRepo
),
libraryDependencies ++= commonDependencies,
libraryDependencies ++= sparkDependencies,
libraryDependencies ++= kafkaDependencies,
dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-databind" % "2.6.7",
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs @ _*) => MergeStrategy.discard
case x => MergeStrategy.first
},
mainClass in assembly := some("com.analytics.user.etl.ETLProcessor"),
assemblyJarName := "user-view-batch-assembly.jar"
)
lazy val userservice = (project in file("user-enrich-service"))
.dependsOn(rulemodule)
.enablePlugins(JavaAppPackaging)
.settings(
name := "user-enrich-service",
version := "1.0",
resolvers ++= Seq(
confluentRepo
),
libraryDependencies ++= commonDependencies,
libraryDependencies ++= kafkaDependencies,
libraryDependencies ++= akkaDependencies,
libraryDependencies ++= mongoDBDependencies
)
建筑性质
sbt.version = 0.13.17
插件。sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.4")
scalaVersion := "2.11.12"
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")
addSbtPlugin("com.cavorite" % "sbt-avro-1-9" % "1.1.7")
装配sbt
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")
错误:
[info] Loading global plugins from C:\Users\smishra5\.sbt\0.13\plugins
[info] Loading project definition from C:\dataanalytics\Recsys\project
[info] Updating {file:/C:/dataanalytics/Recsys/project/}recsys-build...
[info] Resolving com.eed3si9n#sbt-assembly;0.14.6 ...
[warn] module not found: com.eed3si9n#sbt-assembly;0.14.6
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.eed3si9n/sbt-assembly/scala_2.11/sbt_0.13/0.14.6/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.11/sbt_0.13/0.14.6/ivys/ivy.xml
[warn] ==== local: tried
[warn] C:\Users\smishra5\.ivy2\local\com.eed3si9n\sbt-assembly\scala_2.11\sbt_0.13\0.14.6\ivys\ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/eed3si9n/sbt-assembly_2.11_0.13/0.14.6/sbt-assembly-0.14.6.pom
[warn] ==== local-preloaded-ivy: tried
[warn] C:\Users\smishra5\.sbt\preloaded\com.eed3si9n\sbt-assembly\0.14.6\ivys\ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:/C:/Users/smishra5/.sbt/preloaded/com/eed3si9n/sbt-assembly_2.11_0.13/0.14.6/sbt-assembly-0.14.6.pom
[info] Resolving com.typesafe.sbt#sbt-native-packager;1.3.4 ...
[warn] module not found: com.typesafe.sbt#sbt-native-packager;1.3.4
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.sbt/sbt-native-packager/scala_2.11/sbt_0.13/1.3.4/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-native-packager/scala_2.11/sbt_0.13/1.3.4/ivys/ivy.xml
[warn] ==== local: tried
[warn] C:\Users\smishra5\.ivy2\local\com.typesafe.sbt\sbt-native-packager\scala_2.11\sbt_0.13\1.3.4\ivys\ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/typesafe/sbt/sbt-native-packager_2.11_0.13/1.3.4/sbt-native-packager-1.3.4.pom
[warn] ==== local-preloaded-ivy: tried
[warn] C:\Users\smishra5\.sbt\preloaded\com.typesafe.sbt\sbt-native-packager\1.3.4\ivys\ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:/C:/Users/smishra5/.sbt/preloaded/com/typesafe/sbt/sbt-native-packager_2.11_0.13/1.3.4/sbt-native-packager-1.3.4.pom
[info] Resolving com.cavorite#sbt-avro-1-9;1.1.7 ...
[warn] module not found: com.cavorite#sbt-avro-1-9;1.1.7
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.cavorite/sbt-avro-1-9/scala_2.11/sbt_0.13/1.1.7/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.cavorite/sbt-avro-1-9/scala_2.11/sbt_0.13/1.1.7/ivys/ivy.xml
[warn] ==== local: tried
[warn] C:\Users\smishra5\.ivy2\local\com.cavorite\sbt-avro-1-9\scala_2.11\sbt_0.13\1.1.7\ivys\ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/cavorite/sbt-avro-1-9_2.11_0.13/1.1.7/sbt-avro-1-9-1.1.7.pom
[warn] ==== local-preloaded-ivy: tried
[warn] C:\Users\smishra5\.sbt\preloaded\com.cavorite\sbt-avro-1-9\1.1.7\ivys\ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:/C:/Users/smishra5/.sbt/preloaded/com/cavorite/sbt-avro-1-9_2.11_0.13/1.1.7/sbt-avro-1-9-1.1.7.pom
[info] Resolving jline#jline;2.14.3 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.eed3si9n#sbt-assembly;0.14.6: not found
[warn] :: com.typesafe.sbt#sbt-native-packager;1.3.4: not found
[warn] :: com.cavorite#sbt-avro-1-9;1.1.7: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] com.eed3si9n:sbt-assembly:0.14.6 (scalaVersion=2.11, sbtVersion=0.13)
[warn] com.typesafe.sbt:sbt-native-packager:1.3.4 (scalaVersion=2.11, sbtVersion=0.13)
[warn] com.cavorite:sbt-avro-1-9:1.1.7 (scalaVersion=2.11, sbtVersion=0.13)
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.eed3si9n:sbt-assembly:0.14.6 (scalaVersion=2.11, sbtVersion=0.13) (C:\dataanalytics\Recsys\project\plugins.sbt#L5-6)
[warn] +- default:recsys-build:0.1-SNAPSHOT (scalaVersion=2.11, sbtVersion=0.13)
[warn] com.typesafe.sbt:sbt-native-packager:1.3.4 (scalaVersion=2.11, sbtVersion=0.13) (C:\dataanalytics\Recsys\project\plugins.sbt#L1-2)
[warn] +- default:recsys-build:0.1-SNAPSHOT (scalaVersion=2.11, sbtVersion=0.13)
[warn] com.cavorite:sbt-avro-1-9:1.1.7 (scalaVersion=2.11, sbtVersion=0.13) (C:\dataanalytics\Recsys\project\plugins.sbt#L7-8)
[warn] +- default:recsys-build:0.1-SNAPSHOT (scalaVersion=2.11, sbtVersion=0.13)
sbt.ResolveException: unresolved dependency: com.eed3si9n#sbt-assembly;0.14.6: not found
unresolved dependency: com.typesafe.sbt#sbt-native-packager;1.3.4: not found
unresolved dependency: com.cavorite#sbt-avro-1-9;1.1.7: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:320)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:191)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:168)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:156)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:156)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:133)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57)
at sbt.IvySbt$$anon$4.call(Ivy.scala:65)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
at xsbt.boot.Using$.withResource(Using.scala:10)
at xsbt.boot.Using$.apply(Using.scala:9)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
at xsbt.boot.Locks$.apply0(Locks.scala:31)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at sbt.IvySbt.withDefaultLogger(Ivy.scala:65)
at sbt.IvySbt.withIvy(Ivy.scala:128)
at sbt.IvySbt.withIvy(Ivy.scala:125)
at sbt.IvySbt$Module.withModule(Ivy.scala:156)
at sbt.IvyActions$.updateEither(IvyActions.scala:168)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1555)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1551)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$122.apply(Defaults.scala:1586)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$122.apply(Defaults.scala:1584)
at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1589)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1583)
at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60)
at sbt.Classpaths$.cachedUpdate(Defaults.scala:1606)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1533)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1485)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[error] (*:update) sbt.ResolveException: unresolved dependency: com.eed3si9n#sbt-assembly;0.14.6: not found
[error] unresolved dependency: com.typesafe.sbt#sbt-native-packager;1.3.4: not found
[error] unresolved dependency: com.cavorite#sbt-avro-1-9;1.1.7: not found
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q
参考:https://github.com/sbt/sbt-assembly/issues/311
似乎您将SBT使用的Scala版本与项目中使用的Scala版本混为一谈。
如果需要使用Scala 2.11构建项目,只需在build中指定即可。sbt
scalaVersion := "2.11.12"
您必须删除sccalaVersion:="2.11.12"
从项目
文件夹中的plugins.sbt
,因为SBT是用特定的Scala版本预构建的,您不能更改它。例如,0.13.17
是用Scala 2.10构建的,而SBT1. x. x
是用Scala2.12
构建的。
您可以自由使用任何您喜欢的SBT版本,但我建议使用最新的1.3。13
和相应插件的最新版本。
我需要为我的一个子项目构建一个jar,包括依赖项,以便它可以用作。 我有一个多模块的sbt项目,这个模块是最低级别的(也是纯Java)。 我可以(例如使用sbt-onejar、sbt-proGuard或sbt组件)覆盖最低级别模块的打包方式吗? 看起来这些工具真的被设计成发布后的步骤,但是我真的需要一个(替换或附加的)发布的人工制品来包含依赖项(但只适用于这一个模块)。 更新:发布sbt程序集是针
我有一个sbt构建,当我从命令行运行时可以工作,但Intellij不喜欢。我的Intellij运行在Linux上,它的版本是14.1.4,我的scala插件是1.5.2。 Intellij抱怨我使用enablePlugins(JavaAppPackaging)。错误是“表达式类型(DslEntry)必须符合SBT文件中的设置[_]”。 我的项目/构建。属性文件: 我的项目/插件。sbt公司 我bu
在中断三年后回到Play框架,并尝试从最新的Play(2.8.0)和sbt(1.5.5)开始。 我正在尝试运行一个项目并收到以下消息: 在我的文件中,我有: 在我的<code>构建中。sbt文件,我有: 跑步: 我猜可能存在版本冲突,但不确定如何修复。我找到了其他帖子,但他们没有给我答案:未解决的依赖性sbt with play framework 玩!框架和 SBT - ebeans 模块的问题
问题内容: 我正在使用Java和Amazon Web Services进行游戏框架项目。这是我的build.sbt: 如果我在命令行上调用“激活程序运行”,它将与激活程序一起运行。 Intellij无法构建项目。它返回以下错误消息 当我从任何地方调用sbt时,也会出现相同的错误(通过在命令行上调用“ sbt”) 有什么建议我应该去哪里看?错误消息在我的实际playframework项目中不包含任何