Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring Play 2.0 app with IDEA and SBT

Play 2.0 uses SBT. However it provides its own SBT action, idea, to create a module for a new project. You have to create an IDEA project yourself and add the module to it. Fine.

What's not fine is that Play 2.0 is used from its source directory when it's unpacked, and there is a repository/ subdirectory which is in fact an ivy repository, separate from your ~/.ivy2.

How do you configure an SBT build for the app? In the imported libraries, IDEA cannot recognize the Scala compiler.

Play sources are not in the repository/. When I do publish-local building Play 2.0 from git, it deposits the jar, currently at 2.0-RC3-SNAPSHOT, there, but not sources. Running SBT action package-src does produce the source jar, but it seems left in place. Attaching it from IDEA still doesn't show source of FakeRequest.

Would it be preferable to rely on the gen-idea in SBT instead of idea?

like image 535
Alexy Avatar asked Feb 24 '12 23:02

Alexy


People also ask

Which IDES can be used for play applications?

Play supports the NetBeans, IntelliJ IDEA and Eclipse platforms.

How run sbt project in IntelliJ?

Press Ctrl+Alt+S to open the IDE settings and select Build, Execution, Deployment | Build Tools | sbt. In the sbt projects section, select a project for which you want to configure build actions. In the sbt shell section, select the builds option. Click OK to save the changes.

What is sbt in play framework?

sbt : The sbt settings that describe building your application. /conf : Configuration files for your application. /project : Further build description information. /public : Where static, public assets for your application are stored. /test : Where your application's test code will be stored.


2 Answers

I tried this command and it works fine:

play idea with-sources=yes

like image 121
ses Avatar answered Sep 30 '22 09:09

ses


With Play 2.0.1 idea with-sources unfortunately does not work:

$ idea with-sources
[error] Expected end of input.
[error] idea with-sources
[error]     ^

I am using following workaround:

  • eclipsify with-source=true as described on http://www.playframework.org/documentation/2.0.1/IDE
  • Open Eclipse project from IntelliJ IDEA (Eclipse Integration plugin must be activated)
like image 23
lachdrache Avatar answered Sep 30 '22 08:09

lachdrache