Search code examples
debuggingscalaintellij-ideascalatra

How to debug scalatra application in IntelliJ Idea?


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?


Solution

  • 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.