简体   繁体   English

播放2.3 Scala Anorm导入:“未找到:对象主动脉”

[英]Play 2.3 Scala Anorm import: “not found: object anorm”

So I've been working on a web app the last few days and got around to starting the database side of things. 因此,最近几天我一直在开发Web应用程序,并开始着手数据库方面的工作。 The problem I'm getting is: 我遇到的问题是:

not found: object anorm 找不到:对象主动脉

for the line 为线

import anorm._ 导入主动脉

I have 我有

"com.typesafe.play" %% "anorm" % "2.3.6" “ com.typesafe.play” %%“错误”%“ 2.3.6”

and

"anorm" “ANORM”

in my libraryDependencies in the build.sbt. 在build.sbt中的libraryDependencies中。

I have done an "activator clean", "activator compile" and "activator run" along with resynchronizing the IntelliJ IDEA 14.1 project. 我已经完成了“清除激活程序”,“激活程序编译”和“激活程序运行”以及重新同步IntelliJ IDEA 14.1项目。

Using: 使用:

  • Play 2.3 播放2.3
  • Scala 2.11.1 斯卡拉2.11.1

Thanks for any help 谢谢你的帮助

I have had this problem for 2 days and I had to read through the play and anorm documentation to solve it. 我遇到这个问题已有2天了,我必须通读剧本和主音文档以解决问题。 You need to note that, in your version of the play framework, anorm is no longer shipped in there. 您需要注意,在您的play框架版本中,anorm不再在那里提供。 So you have to explicitly declare the anorm dependancy, read: 因此,您必须明确声明对主动脉的依赖性,请阅读:

https://www.playframework.com/documentation/2.5.x/ScalaAnorm https://www.playframework.com/documentation/2.5.x/ScalaAnorm

The above link, relates to the version of anorm you should use with your play version. 上面的链接与您应该在游戏版本中使用的anorm版本有关。 Then add the following in your build.sbt file 然后在您的build.sbt文件中添加以下内容

libraryDependencies ++= Seq(
jdbc,
"com.typesafe.play" %% "anorm" % "2.5.0"
)

resolvers ++= Seq("scalaz-bintray" at "http://dl.bintray.com/scalaz/releases",
"Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/")

Delete the previous dependancies, then you need to build your application once again. 删除以前的依赖关系,然后需要再次构建应用程序。 This time round, restart the play server and then build the application. 这次,重新启动播放服务器,然后构建应用程序。 This worked out so well for me. 这对我来说很好。

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

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