如何使用SBT添加依赖关系来播放框架

时间:2016-09-09 12:38:21

标签: playframework sbt

我尝试将以下依赖项添加到我的新play-framework项目

https://mvnrepository.com/artifact/net.sf.json-lib/json-lib/2.4

所以我将以下内容添加到build.sbt

libraryDependencies += "net.sf.json-lib" % "json-lib" % "2.4"

但是,当我尝试运行应用程序(./activator run)时,我收到以下错误:

[info] Loading project definition from /****/project
[info] Set current project to *** (in build file:/***/)
[info] Updating {file:/****/}root...
[info] Resolving jline#jline;2.12.1 ...
[warn]  [FAILED     ] net.sf.json-lib#json-lib;2.4!json-lib.jar:  (0ms)
[warn] ==== local: tried
[warn]   /***/.ivy2/local/net.sf.json-lib/json-lib/2.4/jars/json-lib.jar
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/net/sf/json-lib/json-lib/2.4/json-lib-2.4.jar
[warn] ==== activator-launcher-local: tried
[warn]   /****/activator/repository/net.sf.json-lib/json-lib/2.4/jars/json-lib.jar
[warn] ==== typesafe-releases: tried
[warn]   https://repo.typesafe.com/typesafe/releases/net/sf/json-lib/json-lib/2.4/json-lib-2.4.jar
[warn] ==== typesafe-ivy-releasez: tried
[warn]   https://repo.typesafe.com/typesafe/ivy-releases/net.sf.json-lib/json-lib/2.4/jars/json-lib.jar
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::              FAILED DOWNLOADS            ::
[warn]  :: ^ see resolution messages for details  ^ ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: net.sf.json-lib#json-lib;2.4!json-lib.jar
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: download failed: net.sf.json-lib#json-lib;2.4!json-lib.jar
        at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:313)
        at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:191)
        at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:168)
        at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:156)
...
[error] (*:update) sbt.ResolveException: download failed: net.sf.json-lib#json-lib;2.4!json-lib.jar
[error] Total time: 16 s, completed Sep 9, 2016 1:30:47 PM

我在这里做错了什么?

编辑注:

刚刚意识到Download ( JAR )中的https://mvnrepository.com/artifact/net.sf.json-lib/json-lib/2.4也无效,

这可能是存储库本身的问题吗?

1 个答案:

答案 0 :(得分:0)

我发现了问题,

问题是我需要在行中添加分类器:

/* localtime example */
#include <stdio.h>      /* puts, printf */
#include <time.h>       /* time_t, struct tm, time, localtime */

int main ()
{
  time_t rawtime;
  struct tm * timeinfo;

  time (&rawtime);
  timeinfo = localtime (&rawtime);
  printf ("Current local time and date: %s", asctime(timeinfo));

  return 0;
}

有关更多信息,请查看此链接,它会更详细地解释:

http://www.scala-sbt.org/0.12.4/docs/Detailed-Topics/Library-Management.html