【问题标题】:Unresolved Dependencies in sbtsbt 中未解决的依赖关系
【发布时间】:2013-10-27 20:53:51
【问题描述】:

运行我的sbt 构建,我得到以下未解决的依赖项

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.typesafe.play#sbt-link;2.2.0: not found
[warn]  :: com.typesafe.play#play-exceptions;2.2.0: not found
[warn]  :: com.typesafe.play#routes-compiler_2.10;2.2.0: not found
[warn]  :: com.typesafe.play#templates-compiler_2.10;2.2.0: not found
[warn]  :: com.typesafe.play#console_2.10;2.2.0: not found
[warn]  :: net.contentobjects.jnotify#jnotify;0.94: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

我的项目结构如下:

parent
 |
  --> sbtApp1
  --> playApp
  --> sbtApp2
  --> project
      --> Build.scala
      --> plugins.sbt
  --> build.sbt

我的 parent/project/plugins.sbt 有以下内容: addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0")

我在 parent/build.sbt 中添加了以下行,但我仍然遇到编译时失败。

libraryDependencies += "play" % "play_2.10" % "2.1.0"

【问题讨论】:

    标签: playframework sbt dependency-management


    【解决方案1】:

    将此行添加到parent/project/plugins.sbt:

    resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
    

    瞧。 (我怎么知道?因为 Play 2.2“入门指南”是这么说的,http://www.playframework.com/documentation/2.2.x/NewApplication。)

    我认为你不需要 libraryDependencies 的东西。

    【讨论】:

    • 可悲的是,我没有像在那个链接中那样手动使用 sbt 安装 play,而是使用激活器。不过,您的修复仍然有效,谢谢!
    【解决方案2】:

    遇到了问题

    sbt.ResolveException: unresolved dependency: org.fusesource.hawtjni#hawtjni-runtime;1.8: configuration not found in org.fusesource.hawtjni#hawtjni-runtime;1.8: 'master(compile)'. Missing configuration: 'compile'. It was required from org.fusesource.leveldbjni#leveldbjni;1.7 compile
    

    在 Fedora 22 上,解决方案很简单:

    ~]$rm -rf .ivy2/ .sbt/
    

    我在互联网上看到各种答案告诉人们删除 .sbt 缓存,但 .ivy2/ 也会导致问题。如果删除这些不能解决问题,您也可以尝试删除 .maven2 目录。这迫使 ivy/gradle/maven 重新下载所有内容。不理想,但可以。

    【讨论】:

      【解决方案3】:

      您将 Play 2.1.0 与 Play 2.2.0 混为一谈。

      不使用:

      libraryDependencies += "play" % "play_2.10" % "2.1.0"
      

      用途:

      libraryDependencies += "com.typesafe.play" % "play_2.10" % "2.2.0"
      

      And be sure, that you have at least one resolver for SBT.

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-12-18
        • 2012-02-02
        • 2017-10-29
        • 2014-01-12
        • 2018-08-18
        • 2017-06-13
        • 1970-01-01
        相关资源
        最近更新 更多