Scala “运行时”;“玩”;发生java.lang.NoSuchMethodError错误
我正在尝试运行从git clone获得的play项目的克隆 我已经安装了play版本2.2.2和scala版本2.10.4 当我在项目克隆到的目录中键入play时,会出现以下错误:Scala “运行时”;“玩”;发生java.lang.NoSuchMethodError错误,scala,playframework,sbt,Scala,Playframework,Sbt,我正在尝试运行从git clone获得的play项目的克隆 我已经安装了play版本2.2.2和scala版本2.10.4 当我在项目克隆到的目录中键入play时,会出现以下错误: java.lang.NoSuchMethodError: scala.Predef$.augmentString(Ljava/lang/String;)Lscala/collection/immutable/StringOps; at sbt.ConsoleLogger$.<init>(Conso
java.lang.NoSuchMethodError: scala.Predef$.augmentString(Ljava/lang/String;)Lscala/collection/immutable/StringOps;
at sbt.ConsoleLogger$.<init>(ConsoleLogger.scala:129)
at sbt.ConsoleLogger$.<clinit>(ConsoleLogger.scala)
at sbt.StandardMain$.<init>(Main.scala:52)
at sbt.StandardMain$.<clinit>(Main.scala)
at sbt.xMain.run(Main.scala:26)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:77)
at xsbt.boot.Launch$.run(Launch.scala:57)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
at xsbt.boot.Launch$.launch(Launch.scala:65)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:32)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.lang.NoSuchMethodError: scala.Predef$.augmentString(Ljava/lang/String;)Lscala/collection/immutable/StringOps;
java.lang.NoSuchMethodError:scala.Predef$.augmentString(Ljava/lang/String;)Lscala/collection/immutable/StringOps;
在sbt.ConsoleLogger$(ConsoleLogger.scala:129)
在sbt.ConsoleLogger$(ConsoleLogger.scala)时
在sbt.StandardMain$(Main.scala:52)
在sbt.StandardMain$(Main.scala)
在sbt.xMain.run(Main.scala:26)
在xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)
在xsbt.boot.Launch$.withContextLoader(Launch.scala:77)
在xsbt.boot.Launch$.run(Launch.scala:57)
在xsbt.boot.Launch$$anonfun$explicit$1.apply处(Launch.scala:45)
在xsbt.boot.Launch$.Launch(Launch.scala:65)
在xsbt.boot.Launch$.apply(Launch.scala:16)
在xsbt.boot.boot$.runImpl处(boot.scala:32)
在xsbt.boot.boot$.main处(boot.scala:21)
位于xsbt.boot.boot.main(boot.scala)
sbt执行期间出错:java.lang.NoSuchMethodError:scala.Predef$.augmentString(Ljava/lang/String;)Lscala/collection/immutable/StringOps;
如果我运行
play clean
,这是正确的。我已经读到这可能是一个依赖性问题,因此我尝试将行scalaVersion:=“2.10.4”
添加到Build.scala的play.Project.settings
部分,并单独添加到Build.sbt文件中。它不起作用 这类问题通常与两个类似的问题有关:
- 缺少具有相同类的jar
- 将同一类放入多个jar
因此,请检查scala和play版本是否兼容,以及是否包含了一个已经包含缺少方法的类的jar。我试图将其放在注释中,但无法读取 谢谢,泽帕曼。看起来这个问题与运行在旧版本Play中创建的Play框架项目有关。通过查看另一个已提交升级到新play版本的项目,我做了以下更改 在build.properties中:
sbt.version=0.12.2
成为:
sbt.version=0.13.0
在plugins.sbt中:
addSbtPlugin("play" % "sbt-plugin" % "2.1.1")
成为:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.2")
"com.typesafe.play" %% "play-slick" % "0.5.0.2-SNAPSHOT"
这使我能够获得播放更新,然后抛出错误:
[error] Modules were resolved with conflicting cross-version suffixes in {file:/Users/michaelrichardson/Documents/Play/play21-osm/}play21-osm:
[error] org.scala-stm:scala-stm _2.10, _2.10.0
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) Conflicting cross-version suffixes in: org.scala-stm:scala-stm
我更改Build.scala中的行:
"com.typesafe.play" %% "play-slick" % "0.3.2"
成为:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.2")
"com.typesafe.play" %% "play-slick" % "0.5.0.2-SNAPSHOT"
额外:这会将错误更改为:
[info] Resolving com.typesafe.play#play-slick_2.10;0.5.0.2-SNAPSHOT ...
[warn] module not found: com.typesafe.play#play-slick_2.10;0.5.0.2-SNAPSHOT
[warn] ==== Typesafe Releases Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/com/typesafe/play/play-slick_2.10/0.5.0.2-SNAPSHOT/play-slick_2.10-0.5.0.2-SNAPSHOT.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe.play#play-slick_2.10;0.5.0.2-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe.play#play-slick_2.10;0.5.0.2-SNAPSHOT: not found
更新:解决了未解决的依赖关系
未解决的依赖关系问题似乎是由于我的本地sbt/ivy存储库被损坏所致。请参见要实现此目的,如果尚未完成,是否可以尝试使用原始版本运行项目?一旦你确定了这一点,你可以尝试移植到新版本的框架。我也搜索了类似的问题,但我只发现,@La comadreja通过在classpath上管理类解决了这个问题,我看到了这个线程,但我不明白从答案中我需要做什么,“解决方案是将相关类放在类路径中。“play slick不在其搜索的位置。有人知道它应该在哪里搜索play slick吗?感谢提供信息。这出戏似乎太滑稽了。版本脆弱性困扰着我。我第一次尝试在一些应用程序中运行sbt时遇到了这个问题,因为sbt版本与我安装的版本不同,我从主目录中删除了.sbt目录,然后运行sbt并正常工作。