{"id":4929,"date":"2017-05-11T18:16:10","date_gmt":"2017-05-11T18:16:10","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=4929"},"modified":"2017-05-11T18:16:10","modified_gmt":"2017-05-11T18:16:10","slug":"starting-out-with-the-playframework-in-intellij","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/starting-out-with-the-playframework-in-intellij\/","title":{"rendered":"Starting out with the Playframework (in IntelliJ)"},"content":{"rendered":"<p><strong>Getting a seed application installed<\/strong><\/p>\n<p>I couldn&#8217;t find a &#8220;how to&#8221; for setting up play from scratch but instead it seems best to download a seed project from the <a href=\"https:\/\/playframework.com\/download\" target=\"_blank\">Play Starter Projects<\/a>. <\/p>\n<p>Select the Play Scala Starter Example and download it &#8211; unzip to a folder and now you have a bare bones play application.<\/p>\n<p><strong>Importing the seed application into IntelliJ<\/strong><\/p>\n<ul>\n<li>From File, select New Project<\/li>\n<li>Select Scala then SBT<\/li>\n<li>Now select the folder where your seed project is<\/li>\n<li>Build the project<\/li>\n<\/ul>\n<p>If you get this error message <em>object index is not a member of package views.html<\/em> then Select View | Tools Windows | Terminal (or Alt+F12) and a terminal window will open, now run the following<\/p>\n<ul>\n<li>sbt clean<\/li>\n<li>sbt compile<\/li>\n<\/ul>\n<p><em>See this post on this problem <a href=\"http:\/\/stackoverflow.com\/questions\/28458597\/object-index-is-not-a-member-of-package-views-html-when-opening-scala-play-pro\" target=\"_blank\">&#8220;object index is not a member of package views.html\u201d when opening scala play project in scala ide&#8221;<\/a>.<\/em><\/p>\n<p>Cleaning then compiling seemed to work for me.<\/p>\n<p><strong>Creating a Run configuration<\/strong><\/p>\n<p>You may find that if you click Run, the only option is &#8220;All in root&#8221; and from this you might find IntelliJ tries to run some tests.<\/p>\n<p>We need to create a new configuration to run play via sbt.<\/p>\n<p><em>See <a href=\"https:\/\/www.playframework.com\/documentation\/2.5.x\/IDE\" target=\"_blank\">Setting up your preferred IDE<\/a>, steps recreated from this post below.<\/em><\/p>\n<ul>\n<li>Select Run | Edit Configuration<\/li>\n<li>Press the + button<\/li>\n<li>Select SBT Task<\/li>\n<li>Name you&#8217;re task &#8211; mine&#8217;s Run Play, simple enough<\/li>\n<li>In the Tasks edit box type <em>run<\/em><\/li>\n<li>Press OK<\/li>\n<\/ul>\n<p>Now when you want to run the application use this configuration and <em>sbt run<\/em> will get executed. Now you can go to http:\/\/locahost:9000 and see your running app.<br \/>\n<a href=\"https:\/\/www.playframework.com\/documentation\/2.5.x\/Tutorials#Play-Seeds\" target=\"_blank\">Play Tutorials<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Getting a seed application installed I couldn&#8217;t find a &#8220;how to&#8221; for setting up play from scratch but instead it seems best to download a seed project from the Play Starter Projects. Select the Play Scala Starter Example and download it &#8211; unzip to a folder and now you have a bare bones play application. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[174,167,165],"tags":[],"class_list":["post-4929","post","type-post","status-publish","format-standard","hentry","category-intellij","category-sbt","category-scala"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/4929","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=4929"}],"version-history":[{"count":3,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/4929\/revisions"}],"predecessor-version":[{"id":4932,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/4929\/revisions\/4932"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=4929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=4929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=4929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}