2014-01-13 57 views
3

我想添加play-json依赖到一个sbt项目。如何将play-json依赖项添加到项目中?

我添加类型安全的存储库中project/plugins.sbt

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

然后我说在Build.scalaplay-json依赖如下:

libraryDependencies += "com.typesafe.play" % "play-json_2.10" % "2.2.1" 

有了这个,我如下遇到错误:

[warn] module not found: com.typesafe.play#play-json_2.10;2.2.1 
[warn] ==== local: tried 
[warn] /home/tminglei/.ivy2/local/com.typesafe.play/play-json_2.10/2.2.1/ivys/ivy.xml 
[warn] ==== sonatype-snapshots: tried 
[warn] https://oss.sonatype.org/content/repositories/snapshots/com/typesafe/play/play-json_2.10/2.2.1/play-json_2.10-2.2.1.pom 
[warn] ==== public: tried 
[warn] http://repo1.maven.org/maven2/com/typesafe/play/play-json_2.10/2.2.1/play-json_2.10-2.2.1.pom 
[info] Resolving org.scala-tools.testing#test-interface;0.5 ... 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
[warn] ::   UNRESOLVED DEPENDENCIES   :: 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 
[warn] :: com.typesafe.play#play-json_2.10;2.2.1: not found 
[warn] :::::::::::::::::::::::::::::::::::::::::::::: 

如何整理出来?

+0

文件'plugins.sbt'在哪里? –

+0

这是它的路径:/[project_root]/project/plugins.sbt – tminglei

回答

3

它看起来像它不使用您定义的解析器。这对我的作品在SBT 13:

import sbt._ 
import Keys._ 

object Build extends sbt.Build { 

    lazy val playjsondep = Project(
    id = "play-json-dep", 
    base = file("."), 
    settings = Project.defaultSettings ++ Seq(
     name := "play-json-dep", 
     organization := "ee.so", 
     version := "0.1-SNAPSHOT", 
     scalaVersion := "2.10.2", 
     resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/", 
     libraryDependencies += "com.typesafe.play" %% "play-json" % "2.2.1" 
    ) 
) 
} 
+0

是的,它也适用于我。非常感谢! :D – tminglei

6

由于依赖是不是一个插件,你应该只在你的项目的主目录中添加resolvers设置build.sbt

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

你真的不需要project/*.scala文件的简单结构。

+0

明白了,非常感谢^^ – tminglei

相关问题