I use play framework 2.6 I need to send a http request to an url, so I use WS for sending this request first I add below line to sbt.build
libraryDependencies += ws
but in controller play cannot resolve ws package
import play.libs.ws.*;
how can I add play.libs.ws to controller???
Try to add
libraryDependencies += "com.typesafe.play" %% "play-ws" % "2.6.3"
to build.sbt (where you can specify proper version instead of 2.6.3) and refresh SBT project.
Then
import play.libs.ws._
in Scala or
import play.libs.ws.*;
in Java should work.
If there is an issue with resolving dependencies try sbt clean
+ sbt update
or re-import the project to IDE.
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.