玩! 2.1 /为什么我的Jerkson依赖不能解决?

时间:2013-05-13 03:36:36

标签: scala sbt playframework-2.1 jerkson

尝试使用https://github.com/randhindi/jerkson中的分叉Jerkson库。将源依赖项克隆到文件夹module中并定义以下内容:

object ApplicationBuild extends Build {

  val appName         = "coolapp"
  val appVersion      = "1.0-SNAPSHOT"

  lazy val jerkson = Project(
    id = "jerkson",
    base = file("module"),
    settings = Seq(
      name               := "jerkson",
      organization       := "com.codahale",
      version            := "0.6.0-SNAPSHOT",
      scalaVersion       := "2.10.0"
    )
  )

  val appDependencies = Seq(
    "com.codahale" % "jerkson" % "0.6.0-SNAPSHOT",
    "jp.t2v" %% "play2.auth"      % "0.9",
    "jp.t2v" %% "play2.auth.test" % "0.9" % "test",
    "org.ocpsoft.prettytime" % "prettytime" % "1.0.8.Final",
    "com.typesafe" %% "play-plugins-redis" % "2.1-1-RC2",
    "net.databinder.dispatch" %% "dispatch-core" % "0.10.0"
  )

// resolvers follow
}

然而,当我去编译时,它给了我以下错误:

sbt.ResolveException: unresolved dependency: com.codahale#jerkson;0.6.0-SNAPSHOT: not found

这里有任何猜测吗?奇怪的是,这是我第一次需要解决源依赖关系以避免无知。谢谢!

2 个答案:

答案 0 :(得分:3)

确保您已将此存储库添加到resolvers中的Build.scala序列中:

resolvers ++= Seq("Codahale" at "http://repo.codahale.com")

<强> ---------- UPDATE:

repo.codahale.com仅包含针对scala 2.9.x

的Jerkson罐子

尝试使用此repo以获取与scala 2.10.x兼容的jar(Play 2.1使用):

https://github.com/cphylabs/jerkson

link建议仅添加:

"com.cloudphysics" % "jerkson_2.10" % "0.6.3" 

答案 1 :(得分:0)

此库应该在"http://repo.typesafe.com/typesafe/releases"处提供,因此不需要提及其他解析器;以下构建脚本只需添加"com.cloudphysics" % "jerkson_2.10" % "0.6.3"即可。

    1 import play.Project._                                                                                                                           
    2                                                                                                     
    3 name := "smartad-backend"                                                                           
    4                                                                                                     
    5 version := "1.0"                                                                                    
    6                                                                                                     
    7 playScalaSettings                                                                                   
    8                                                                                                     
    9                                                                    
   10 libraryDependencies ++= Seq(                                                                        
   11                             jdbc,                                                                   
   12                             anorm,                                                                  
   13                             "com.google.zxing"   % "core"                 % "2.0",                  
   14                             "mysql"              % "mysql-connector-java" % "5.1.27",               
   15                             "com.typesafe.slick" %% "slick"               % "2.1.0",                
~  16                             "org.slf4j"          % "slf4j-nop"            % "1.6.4",                
+  17                             "com.cloudphysics" % "jerkson_2.10" % "0.6.3"                           
   18                                     
   19                            )  

以上构建脚本适用于play framework 2.2.0。