简体   繁体   English

播放框架2.6无法解决

[英]play framework 2.6 ws cannot resolve

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 我使用播放框架2.6,我需要向url发送一个http请求,因此我首先使用WS发送此请求,然后在sbt.build的下面添加了一行

    libraryDependencies += ws

but in controller play cannot resolve ws package 但是在控制器播放中无法解析ws包

    import play.libs.ws.*;

how can I add play.libs.ws to controller??? 如何将play.libs.ws添加到控制器???

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. 到build.sbt(您可以在其中指定正确的版本而不是2.6.3)并刷新SBT项目。

Then 然后

import play.libs.ws._

in Scala or 在Scala或

import play.libs.ws.*;

in Java should work. 在Java中应该起作用。

If there is an issue with resolving dependencies try sbt clean + sbt update or re-import the project to IDE. 如果解决依赖项存在问题,请尝试sbt clean + sbt update或将项目重新导入到IDE。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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