Alexy
Alexy

Reputation: 1530

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?

Upvotes: 5

Views: 2260

Answers (3)

ses
ses

Reputation: 13362

I tried this command and it works fine:

play idea with-sources=yes

Upvotes: 5

lachdrache
lachdrache

Reputation: 151

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:

Upvotes: 2

Leon Radley
Leon Radley

Reputation: 7682

Since play has been released in final the idea command has been significantly improved.

You can also call it like this

idea with-sources

And it will download all docs and sources and configure them correctly.

You can also connect to plays debugger by starting play with

Play debug

And then choose remote debugging in idea and select port 9999

Upvotes: 1

Related Questions