Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Update</strong>: In newer versions if IntelliJ IDEA, it is no longer necessary to create the module from play/activator. IntelliJ IDEA has now a really good support for SBT projects. If exists, delete all the idea related directories inside your project. Then in IntelliJ IDEA click File -> Open and choose your build.sbt file. That's all.</p> <hr> <p>IntelliJ IDEA has a good integration for the Play Framework 2. Sometimes it jams, but most of the time it runs. I use it to run(single, all) tests, start or debug the play application and edit my code (o; And this all from within the IDE and without the sbt console.</p> <p>Here is a short tutorial with the most important steps. Currently I use IntelliJ IDEA 12.1 with the newest Play Framework 2 and Scala plugins.</p> <p><strong>1. Create a new application</strong></p> <pre><code>play new myapp </code></pre> <p><strong>2. Create the IDE module</strong></p> <p>Start the play console:</p> <pre><code>cd newapp play </code></pre> <p>Create the module:</p> <pre><code>idea with-sources=yes exit </code></pre> <p><strong>3. Configure the IDE</strong></p> <ol> <li>Open the newly created project</li> <li>Open the module settings(select project and press F4)</li> <li>Add the Scala library to your project <ol> <li>Select <em>Modules->myapp->Dependencies</em> </li> <li>Press the plus Icon and select Library(2)</li> <li>Add the Scala 2.10.0 Project Library</li> </ol></li> <li>Select the Compiler Library in the Scala Facet <ol> <li>Select <em>Facets->Scala(myapp)</em></li> <li>Set the <em>Compiler library</em> to Scala 2.10.0</li> </ol></li> <li>Fix the errors <ol> <li>Select <em>Modules->myapp-build->Dependencies->scala-2.9.2</em> and press the minus icon</li> <li>Select <em>Libraries->Scala 2.9.2</em> and press the minus icon</li> </ol></li> <li>Fix the output Path for the <em>myapp-build</em> module <ol> <li>Select <em>Modules->myapp-build->Paths</em></li> <li>Append <em>classes</em> to the <em>Output path</em>(X:\projects\myapp\project\target\scala_2.9.2\classes)</li> <li>Append <em>test-classes</em> to the <em>Test output path</em>(X:\projects\myapp\project\target\scala_2.9.2\test-classes)</li> </ol></li> </ol> <p><strong>4. Run a test</strong></p> <p>Select the <em>ApplicationSpec</em> under the test directory and click <em>Run 'ApplicationSpec'</em> from the context menu. You should get an error that the compiled template could not be found. This is because the IDE doesn't compile the templates, but this can be done by run the application once. Also follow point 5 and then run the test again.</p> <p><strong>5. Run the application</strong></p> <p>Select a controller and click <em>Run Play 2 App</em> from context menu. This should start the application on address: <code>http://localhost:9000/</code>.</p> <p><strong>6. Update dependencies</strong></p> <p>If you update your application dependencies then you must tell the IDE about this changes. Also after running the <em>play update</em> command you must close the IDE and remove some files from project directory. If you execute the <code>play idea</code> command before removing the files, you get double dependencies in your play project.</p> <p>Execute the following steps to update your dependencies:</p> <ol> <li>Run the <code>update</code> task from your play console</li> <li>Remove the <em><code>.idea_modules</code></em> and <em><code>.idea/libraries</code></em> directories</li> <li>Run the <code>idea with-sources=yes</code> command in the play console</li> <li>Run step 3 again</li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload