Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij IDEA 12 doesn't recognize Playframework 2.1 (java) dependencies set in Build.scala

I have the following dependencies added to my Build.scala and they work perfectly (no compilation errors), but Intellij IDEA 12 doesn't recognize them. It shows them red highlighted.

"com.google.inject" % "guice" % "3.0",
"com.typesafe" %% "play-plugins-mailer" % "2.1-RC2"

enter image description here

It is quite annoying as you can see :)

Is it possible to fix it? In google guice case, I put its jars into /lib folder (so I have the library twice, one in /lib and the other in /target folder) and then IDEA doesn't show errors for it, but I don't like this workaround and can't do the same for the Mailer plugin.

Thanks for your help.

like image 708
Franco Avatar asked Jul 05 '13 00:07

Franco


People also ask

How to add Play plugin to IntelliJ?

In the Project tool window, in the project source root directory, select New | File to create the plugins. sbt file. Open the plugins. sbt file in the editor and add the Play 2 plugin.

How do I create a Scala jar in IntelliJ?

IntelliJ IDEA enables creation of JAR as an artifact of a project. Do the following steps. From the Project Structure window, navigate to Artifacts > the plus symbol + > JAR > From modules with dependencies.... In the Create JAR from Modules window, select the folder icon in the Main Class text box.

How can I download Scala plugin in IntelliJ?

To install Scala plugin, press Ctrl+Alt+S , open the Plugins page, browse repositories to locate the Scala plugin, click Install and restart IntelliJ IDEA.


1 Answers

You have to rerun the play idea command in order to get IntelliJ to know that there are new dependencies added.

I normally enter the play CLI and then run:

idea no-sbt-build-module with-sources=yes

This will download the sources for the dependencies (if they exist) and also make sure that the output path will be correct and that modules are not loaded several times.

like image 50
maba Avatar answered Oct 17 '22 09:10

maba