简体   繁体   中英

IntelliJ not resolving Play's build.sbt libraryDependencies

I am new to IntelliJ IDE and I am trying to use it for a new Play project I am working on. I have added some libraries to the libraryDependencies in build.sbt but IntelliJ cannot seem to resolve them as External Libraries

libraryDependencies ++= Seq(
  jdbc,
  anorm,
  cache,
  "org.reactivemongo" %% "play2-reactivemongo" % "0.10.2",
  "org.webjars" % "angularjs" % "1.2.13",
  "org.webjars" % "foundation" % "5.1.1"
) 

I am using the Play 2.0 Plugin for IntelliJ Ultimate and I also have the sbt and Scala plugins installed.

When I run the play run command from the command line everything compiles and works fine, but it is annoying seeing all the errors in the IDE:

在此处输入图片说明

Run additionally

play idea

or

play "idea with-sources=yes"

And reload project when IntelliJ will ask for that

If you're using IntelliJ 13 it has built in SBT support. You'll need to reimport your project (that is, delete the .idea folder, and then Import Project). From there you get a nice little menu on the right hand side and you can set it to autorefresh when the Build files change (or manually refresh).

The nice thing about SBT integration in IntelliJ is that it will preserve your other project settings, which I don't believe the play idea command does.

在此处输入图片说明

You can just run the following command (when you are in play console) :

update
reload

Idea will detect some change and it will ask you to reload the project.

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