5

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!

Community
  • 1
  • 1
Alexzander
  • 345
  • 5
  • 8

1 Answers1

1

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.

retronym
  • 54,768
  • 12
  • 155
  • 168
  • Thanks alot! I wrote a main method for jetty 8 (api has slightly changed http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty) and it worked! The last thing - I`m still using an SBT console in parallel with debugging (I run "~compile" command), cause JRebel requires continious compilation of the sources for its proper work. I was hoping that I can assign a before launch SBT Action "~compile", but there is no such an option. Maybe you can suggest a workaround for it? – Alexzander Jan 08 '12 at 23:34
  • 1
    I have the same problem, bit this solution did not work for me, because I do not write a web application at all. – Arne May 10 '13 at 22:11