【问题标题】:SBT not resolving Squeryl dependencySBT 没有解决 Squeryl 依赖
【发布时间】:2013-06-02 12:30:23
【问题描述】:

我最近用 Play! 开始了一个新项目!框架和 Scala。 我习惯于将 Squeryl 用于我的 ORM,但由于某种原因,这次它无法解决我的依赖关系(虽然它会解决其他问题,但不是 squeryl)。

唯一不同的是,我使用的计算机与以前不同(现在是 Windows,以前是 Arch),而且我使用的是 Play 2.1.1 而不是 2.1。

编辑:我也支持代理,我认为这可能已经解决,因为我可以解决一些依赖关系,但除了代理与 sbt 搞砸之外,我看不到任何其他原因。我可以在我的浏览器中看到 squeryl 的 maven repo,但是 sbt 找不到它。

build.properties:

sbt.version=0.12.2

构建.scala:

val appDependencies = Seq(
// Add your project dependencies here,
  jdbc,
  "org.squeryl" %% "squeryl" % "0.9.5-6"
)

plugins.sbt:

// Comment to get more information during initialization
logLevel := Level.Warn

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

// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.1.1")

控制台:

C:\Path\To\Play\APP>play run
[info] Loading project definition from C:\Path\To\Play\APP
....
[warn]  module not found: org.squeryl#squeryl_2.10;0.9.5-6
[warn] ==== local: tried
[warn]   C:\Path\To\Play\play-2.1.1\repository\local\org.squeryl\squeryl_2.10
[warn] ==== Typesafe Releases Repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/org/squeryl/squeryl_2.10/0.9.5-6/squeryl_2.10-0.9.5-6.po
[warn] ==== Typesafe Snapshots Repository: tried
[warn]   http://repo.typesafe.com/typesafe/snapshots/org/squeryl/squeryl_2.10/0.9.5-6/squeryl_2.10-0.9.5-6.p
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/squeryl/squeryl_2.10/0.9.5-6/squeryl_2.10-0.9.5-6.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.squeryl#squeryl_2.10;0.9.5-6: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: org.squeryl#squeryl_2.10;0.9.5-6: not found
    at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:214)
    at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:122)
    ...
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
[error] (*:update) sbt.ResolveException: unresolved dependency: org.squeryl#squeryl_2.10;0.9.5-6: not found
[warn] some of the dependencies were not recompiled properly, so classloader is not avaialable
[info] Updating {file:/C:/Path/To/Play/APP}
[warn]  module not found: org.squeryl#squeryl_2.10;0.9.5-6
[warn] ==== local: tried
[warn]   C:\Path\To\Play\play-2.1.1\repository\local\org.squeryl\squeryl_2.10
[warn] ==== Typesafe Releases Repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/org/squeryl/squeryl_2.10/0.9.5-6/squeryl_2.10-0.9.5-6.po
[warn] ==== Typesafe Snapshots Repository: tried
[warn]   http://repo.typesafe.com/typesafe/snapshots/org/squeryl/squeryl_2.10/0.9.5-6/squeryl_2.10-0.9.5-6.p
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/squeryl/squeryl_2.10/0.9.5-6/squeryl_2.10-0.9.5-6.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.squeryl#squeryl_2.10;0.9.5-6: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: org.squeryl#squeryl_2.10;0.9.5-6: not found
    at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:214)
    .....
    at java.lang.Thread.run(Unknown Source)
[error] (*:update) sbt.ResolveException: unresolved dependency: org.squeryl#squeryl_2.10;0.9.5-6: not found

【问题讨论】:

  • 尝试添加“sonatype”,看看效果如何? "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots", "Sonatype releases" at "http://oss.sonatype.org/content/repositories/releases"

标签: scala playframework dependencies sbt squeryl


【解决方案1】:

当你看到http://repo1.maven.org/maven2/org/squeryl/ 你会得到解决方案的。

PROJECT/project/Build.scala

   val appDependencies = Seq(
 // Add your project dependencies here,
  jdbc,
  anorm,
  "org.squeryl" % "squeryl_2.10" % "0.9.5-6"
)

【讨论】:

  • 我可以在浏览器中导航并查看它,但由于某种原因 sbt 不能...[warn] ==== public: tried [warn] http://repo1.maven.org/maven2/org/squeryl/squeryl_2.10/0.9.5-6/squeryl_2.10-0.9.5-6.pom
  • 对于 Play 2.6 或更低版本,"org.squeryl" %% "squeryl" % "0.9.5-7" 条目将起作用。
【解决方案2】:

这是来自我的 build.sbt(嗯,相关部分)- 什么 scala 版本?

scalaVersion := "2.10.1"

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

libraryDependencies ++= Seq( "org.squeryl" %% "squeryl" % "0.9.5-6",

【讨论】:

  • 解析器和我的一样,但是 play 把它自己的 scala 打包到了自己的里面。我实际上没有 build.sbt 文件,我有一个 plugins.sbt 文件。但它确实使用 scala 2.10,它在我的目标文件夹中。
  • 等一下,你的意思是你将 squeryl 复制粘贴到 plugins.sbt 中?这行不通,因为 squeryl 不是 SBT 插件..
  • 不不不,我在原始文件中发布的代码是我的 Build.scala 文件。 plugins.sbt 文件基本上看起来像您发布的添加了一些游戏内容的文件。
【解决方案3】:

为确保这不是潜在的 SBT 项目的配置问题,暂时不要使用 %% 表示法。事实上,这会自动选择与您当前的 scala 版本相对应的 Jar 版本,这可能与您期望的不同(您的 conf 中的疏忽,某些配置文件中的变量冲突等......)。

为了隔离你的“错误”上下文,更喜欢这个:

 libraryDependencies += "org.squeryl" % "squeryl" % "0.9.5-6"

【讨论】:

    【解决方案4】:

    这最终成为我工作中的代理的问题,设置错误,必须更正。现在一切都很好!

    【讨论】:

      猜你喜欢
      • 2014-12-27
      • 2014-12-18
      • 2014-12-17
      • 2014-01-12
      • 2016-06-19
      • 2015-12-19
      • 2018-06-18
      • 2017-11-05
      • 2016-02-13
      相关资源
      最近更新 更多