Windows:
Set your sbt.bat to the following:
set SCRIPT_DIR=%~dp0
set SBT_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999
java %SBT_OPTS% -Xmx512M -XX:MaxPermSize=256m -jar “%SCRIPT_DIR%sbt-launch.jar” %*
Run SBT in your project folder and then the ‘run’ command
In IntelliJ set up a run configuration (Run/Edit Configurations) as follows:
Add a new ‘Remote’ configuration
Give it a name
Set transport to ‘Socket’
Set debugger to ‘Attach’
Set host to localhost set port to 9999 (so it matches the port you set in SBT_OPTS in the sbt.bat file)
Put in some breakpoints and hit debug.
I’ll add in Linux/MacOs instructions next time I’m at a Linux box…