简体   繁体   中英

How to add dependencies to play framework using SBT

I'm trying to add the following dependencies into my new play-framework project

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

so I add the following into build.sbt

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

however, when I try to run the application ( ./activator run ) I get the following error:

[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

What am I doing wrong here?

EDIT NOTE:

just realised the Download ( JAR ) in https://mvnrepository.com/artifact/net.sf.json-lib/json-lib/2.4 doesn't work either,

could it be an issue with repository itself?

I found the problem,

the problem was I needed to add classifier to the line:

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

for more information check out this link, it explain in more details:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM