未解决的依赖关系 sbt with play framework
Posted
技术标签:
【中文标题】未解决的依赖关系 sbt with play framework【英文标题】:Unresolved Dependencies sbt with play framework 【发布时间】:2018-08-18 11:33:17 【问题描述】:由于我是 Stack Overflow 的新手,请耐心等待,我正在使用 Play 2.5 进行项目,这正是网站上的入门示例。
因为我必须使用 ebean,所以我遵循了在 plugins.sbt 中设置 ebean 的步骤,就像
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "3.0.0")
也在我的 build.sbt 文件中
name := """play-java"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean)
scalaVersion := "2.11.11"
libraryDependencies += javaJdbc
libraryDependencies += cache
libraryDependencies += javaWs
libraryDependencies += filters
libraryDependencies += evolutions
libraryDependencies ++= Seq(
"mysql" % "mysql-connector-java" % "5.1.18",
"org.webjars" %% "webjars-play" % "2.3.0",
"org.webjars" % "bootstrap" % "3.0.0" exclude("org.webjars", "jquery"),
"org.webjars" % "jquery" % "1.8.3"
)
但我得到以下错误输出
Resolving com.typesafe.sbt#sbt-play-ebean;3.0.0 ...
[warn] module not found: com.typesafe.sbt#sbt-play-ebean;3.0.0
[warn] ==== local: tried
[warn] C:\Users\Dexter66\.ivy2\local\com.typesafe.sbt\sbt-play-ebean\scala_2.11\sbt_0.13\3.0.0\ivys\ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/typesafe/sbt/sbt-play-ebean_2.11_0.13/3.0.0/sbt-play-ebean-3.0.0.pom
[info] Resolving jline#jline;2.14.3 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe.sbt#sbt-play-ebean;3.0.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] com.typesafe.sbt:sbt-play-ebean:3.0.0 (scalaVersion=2.11, sbtVersion=0.13)
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.typesafe.sbt:sbt-play-ebean:3.0.0 (scalaVersion=2.11, sbtVersion=0.13) (C:\Users\Dexter66\Desktop\Uebungsprojekte_Play\play-java-starter-examp
le-2.5.x - Kopie\plugin.sbt#L1-2)
[warn] +- play-java:play-java_2.11:1.0-SNAPSHOT
[info] Wrote C:\Users\Dexter66\Desktop\Uebungsprojekte_Play\play-java-starter-example-2.5.x - Kopie\target\scala-2.11\play-java_2.11-1.0-SNAPSHOT.pom
sbt.ResolveException: unresolved dependency: com.typesafe.sbt#sbt-play-ebean;3.0.0: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:313)
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:93)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
at xsbt.boot.Using$.withResource(Using.scala:10)
at xsbt.boot.Using$.apply(Using.scala:9)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
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:1488)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1484)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$121.apply(Defaults.scala:1519)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$121.apply(Defaults.scala:1517)
at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1522)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1516)
at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60)
at sbt.Classpaths$.cachedUpdate(Defaults.scala:1539)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1466)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1418)
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(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
[error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe.sbt#sbt-play-ebean;3.0.0: not found
Cannot start with errors.
我也尝试过文件描述的方式-->无效缓存/重启但也没有帮助
【问题讨论】:
"com.typesafe.play" %% "play" % "2.6.12"
库依赖项在哪里?或者,您使用的是哪个播放版本?
我正在使用 Play 2.5
您是否遵循了这些说明playframework.com/documentation/2.6.x/JavaEbean ?
是的,我遵循了,但不幸的是,除非我在 build.sbt 中放入惰性 val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean) 但随后我得到一个导入 SBT 项目时出现新错误: build.sbt:5:错误:未找到:value PlayEbean 惰性 val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean) ^ sbt.compiler. EvalException:表达式中的类型错误 [error] sbt.compiler.EvalException:表达式中的类型错误无效的响应。
【参考方案1】:
我认为您的问题出在 sbt 的 scala 版本上。 sbt 0.13 适用于 scala 2.10,sbt 1.0 适用于 scala 2.12
您使用的所有插件都必须与 sbt 处于相同的 scala 版本中
从这一行开始:
com.typesafe.sbt:sbt-play-ebean:3.0.0 (scalaVersion=2.11, sbtVersion=0.13)
我知道您使用的是 sbt 0.13.x,但在某处将 scala 版本设置为 2.11.x
(可能在project/build.sbt
或project/plugins.sbt
)
你不应该在这些文件中设置 scala 版本
澄清一下,我不是在谈论
scalaVersion := "2.11.11"
你的 build.sbt 里有,没问题。 我说的是 sbt 进程的 scala 版本,它是自己的
【讨论】:
只是添加您需要修改的文件是项目目录中的build.properties,更具体地说是sbt.version
属性...感谢@lev您的回答解决了我的问题以上是关于未解决的依赖关系 sbt with play framework的主要内容,如果未能解决你的问题,请参考以下文章
未解决的依赖关系:com.typesafe.play#play-slick_2.10;0.6.0.1:未找到