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:

enter image description here

有帮助吗?

解决方案

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.

enter image description here

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top