Search code examples
scalaintellij-idealiftsbtjrebel

How to create an SBT Run configuration in IntelliJ IDEA 11 Community Edition?


I have created a Lift project ifor IDEA 11 Community Edition using an sbt-idea plugin. It compiles and runs well from SBT plugins SBT console, I`m also able to debug it via creating right "Remote" configuration.

But how do I create an SBT Run configuration?

I don't want to type each time "container:start" in SBT console, I want to startup using a Run/Debug button.
I was unable to find some SBT configuration type (like there is available a "Maven" type), and when I try to add configuration based on "Application type" I cannot specify the main class.

There is also no "Scala Compilation Server" type available (I cannot see it in the list of available configuration types), so I cannot use solutions like this https://stackoverflow.com/a/6131737/705819/
Are there any specific actions that should be done for the "Scala Compilation Server" type to show up? Or does it available only in the full edition of IDEA?

UPDATE: I`m also using JRebel for my project. Without proper run configuration I have to run SBT with JRebel via VM parameters and debug via Remote configuration - so it makes me to restart debugger each time I update the code (cause Jrebel reloads the class) instead of just clicking "Debug with Jrebel" button (thanks to the Jrebel IDEA plugin). It is very annoying, please help!


Solution

  • How much of the servlet container do you need? I would recommend to write a normal main method that starts an embedded Jetty.

    Add this to your build settings to add Jetty to the test classpath:

    libraryDependencies += "org.mortbay.jetty" % "jetty" % "6.1.22" % "test"
    

    Then take a code snippet from here to start Jetty:

    You can set up a pre-run action for this Run Configuration to run sbt package, which will create a the WAR.