5

I can't find any documentation or examples of debugging Scalatra apps in IntelliJ Idea. Is it possible to run the Scalatra app in debug mode to attach the Idea?

Valentin V
  • 24,971
  • 33
  • 103
  • 152
  • On the last ScalaDev i've asked one of JetBrains' guys about scalatra support and he told that have plans to add it soon – 4lex1v May 23 '13 at 15:28
  • 1
    Debugging any JVM app, including scalatra should be no different from the way described in the above link. First -- you're starting scalatra with additional options (they're listed in that topic and in IDEA run configurations tab), then you're attaching IDEA debugger [in remote mode](https://www.jetbrains.com/idea/webhelp/run-debug-configuration-remote.html). – om-nom-nom May 23 '13 at 15:30
  • @om-nom-nom, I don't know how to start the scalatra app in debug mode, and my question clearly states that. – Valentin V May 23 '13 at 15:34

1 Answers1

10

First. Go to the IDEA an choose edit configurations action:

enter image description here

On this tab, add new remote configuration:

enter image description here

Next, run Scalatra with those options:

enter image description here

For example:

java 
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005  -jar **-assembly-**.jar

Now hit the green debug button of your IDEA and enjoy debugging. There might be another ways to run scalatra (e.g. from sbt jetty-run) but generally all you need is to feed those options to the jvm instance.

om-nom-nom
  • 62,329
  • 13
  • 183
  • 228