1

尝试使用来自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

这里有什么猜测吗?奇怪的是,这是我第一次需要解决源依赖关系,所以不要无知。谢谢!

4

2 回答 2

3

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

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

- - - - - 更新:

repo.codahale.com 仅包含适用于 scala 2.9.x 的 Jerkson jar

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

https://github.com/cphylabs/jerkson

链接建议仅添加:

"com.cloudphysics" % "jerkson_2.10" % "0.6.3" 
于 2013-05-13T06:52:21.357 回答
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。

于 2014-12-25T17:35:48.993 回答