【问题标题】:java.lang.RuntimeException: could not find scala-library.jarjava.lang.RuntimeException:找不到 scala-library.jar
【发布时间】:2014-03-08 09:59:18
【问题描述】:

我有一个使用 java 1.7、Play 2.2.0 构建的 play 项目,我正在尝试使用以下命令为我的项目创建 Eclipse 项目文件:

 F:\Projects\test>play

 [test] $ clean

 [test] $ compile     

 [test] $ eclipse with-source=true   

但它抛出以下错误:-

java.lang.RuntimeException: could not find scala-library.jar
        at play.PlayEclipse$$anon$7$$anonfun$createTransformer$3$$anonfun$3.apply(PlayEclipse.scala:80)
        at play.PlayEclipse$$anon$7$$anonfun$createTransformer$3$$anonfun$3.apply(PlayEclipse.scala:80)
        at scala.Option.getOrElse(Option.scala:120)
        at play.PlayEclipse$$anon$7$$anonfun$createTransformer$3.apply(PlayEclipse.scala:80)
        at play.PlayEclipse$$anon$7$$anonfun$createTransformer$3.apply(PlayEclipse.scala:79)
        at scalaz.Validation$class.map(Validation.scala:114)
        at scalaz.Success.map(Validation.scala:343)
        at play.PlayEclipse$$anon$7.createTransformer(PlayEclipse.scala:79)
        at com.typesafe.sbteclipse.core.Eclipse$$anonfun$5$$anonfun$apply$4$$anonfun$6.apply(Eclipse.scala:120)
        at com.typesafe.sbteclipse.core.Eclipse$$anonfun$5$$anonfun$apply$4$$anonfun$6.apply(Eclipse.scala:120)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
        at scala.collection.immutable.List.foreach(List.scala:318)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
        at scala.collection.AbstractTraversable.map(Traversable.scala:105)
        at com.typesafe.sbteclipse.core.Eclipse$$anonfun$5$$anonfun$apply$4.apply(Eclipse.scala:120)
        at com.typesafe.sbteclipse.core.Eclipse$$anonfun$5$$anonfun$apply$4.apply(Eclipse.scala:116)
        at scala.Option$WithFilter.map(Option.scala:206)
        at com.typesafe.sbteclipse.core.Eclipse$$anonfun$5.apply(Eclipse.scala:116)
        at com.typesafe.sbteclipse.core.Eclipse$$anonfun$5.apply(Eclipse.scala:115)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
        at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
        at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
        at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
        at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
        at com.typesafe.sbteclipse.core.Eclipse$.handleProjects(Eclipse.scala:115)
        at com.typesafe.sbteclipse.core.Eclipse$.action(Eclipse.scala:101)
        at com.typesafe.sbteclipse.core.Eclipse$$anonfun$eclipseCommand$2.apply(Eclipse.scala:82)
        at com.typesafe.sbteclipse.core.Eclipse$$anonfun$eclipseCommand$2.apply(Eclipse.scala:82)
        at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)
        at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)
        at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)
        at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)
        at sbt.Command$.process(Command.scala:95)
        at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:87)
        at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:87)
        at sbt.State$$anon$1.process(State.scala:176)
        at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:87)
        at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:87)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
        at sbt.MainLoop$.next(MainLoop.scala:87)
        at sbt.MainLoop$.run(MainLoop.scala:80)
        at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:69)
        at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:66)
        at sbt.Using.apply(Using.scala:25)
        at sbt.MainLoop$.runWithNewLog(MainLoop.scala:66)
        at sbt.MainLoop$.runAndClearLast(MainLoop.scala:49)
        at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:33)
        at sbt.MainLoop$.runLogged(MainLoop.scala:25)
        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] could not find scala-library.jar
[error] Use 'last' for the full log.

【问题讨论】:

    标签: java eclipse scala playframework playframework-2.0


    【解决方案1】:

    我遇到了同样的错误。 原因是我在 plugins.sbt 中有:

    addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")
    

    虽然依赖模块(我在 Build.scala 中的 appDependencies)有:

    addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.2")
    

    更正到 2.2.2 解决了错误。

    我的游戏仍然是 2.2.1 版本,我得到了:

    This project uses Play 2.2.2!
    Update the Play sbt-plugin version to 2.2.1 (usually in project/plugins.sbt)
    

    但它现在有效,我懒得更新:-)

    【讨论】:

      【解决方案2】:

      您能否验证您使用的 Play 框架的版本是什么,同时验证它是否与您的“plugins.sbt”中的版本匹配:

          /project/plugins.sbt
      

      应该是这样的:

          addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.2") 
      

      这是 Play 2.2.2 的 know issue,但似乎已经解决了。

      【讨论】:

        【解决方案3】:

        我认为您不应该添加 scala-library.jar,因为您应该按照以下方法使用它们:

        第一次运行 Forge 时,它​​需要下载一堆与您的系统匹配的代码库。其中之一是由于某种原因无法下载,这是 Forge 运行所必需的。不过我可以在我的浏览器中下载它,所以阻止 Forge 自动下载它并不能阻止我手动下载它。

        以下是您可以解决的方法:

        1. Download the library manually。 (这与错误中的链接相同 在您的问题中留言。)

        2. 这将下载一个名为 scala-library-2.10.2.jar 的文件。保存 您可以在某个地方再次找到它。

        3. 打开您的 .minecraft 文件夹,然后导航到 libraries → org

        4. org 文件夹中,创建文件夹 scala-lang

        5. 打开新的scala-lang文件夹并创建文件夹scala-library 在里面。

        6. 打开新的 scala-library 并在其中创建文件夹 2.10.2

        7. 打开新的2.10.2 文件夹。在任何地方查找 scala-library-2.10.2.jar 您在步骤(1)中保存了它,并将其放入 2.10.2 中。

        8. 现在仔细检查所有文件夹的名称是否与上述完全相同, 没有多余的字母,每个文件夹前后都没有空格 姓名。任何错误都会阻止下一步工作。修复任何 在继续之前发现的命名错误。

        9. 运行启动器并启动 Forge。当它达到它的地步时 以前尝试下载Scala,应该能找到你刚刚的库 手动安装并继续运行。

        【讨论】:

          【解决方案4】:

          我遇到了这个问题,它似乎与 webjars 有关。

          添加排除项有效。

          "org.webjars" %% "webjars-play" % "2.2.1" exclude("org.scala-lang", "scala-library")
          

          更多:-https://github.com/webjars/webjars-play/issues/27

          【讨论】:

            猜你喜欢
            • 2012-12-20
            • 2013-04-27
            • 2011-05-28
            • 1970-01-01
            • 2014-05-22
            • 2012-08-01
            • 2014-01-24
            • 2011-04-03
            相关资源
            最近更新 更多