Skip to content

Instantly share code, notes, and snippets.

@carymrobbins
Last active July 25, 2017 18:11
Show Gist options
  • Save carymrobbins/df6b39b0aa8a0c462d0e to your computer and use it in GitHub Desktop.
Save carymrobbins/df6b39b0aa8a0c462d0e to your computer and use it in GitHub Desktop.
IntelliJ SBT Debug script for remote debugging, particularly through Vagrant.
#!/bin/bash
set -ex
# Sets the port that IntelliJ attaches to
true ${LISTEN_PORT:=5005}
# Sets whether or not the process waits for the debugger to attach
true ${SUSPEND:=y}
JVM_DEBUG=-Xdebug
JVM_RUN=-Xrunjdwp:transport=dt_socket,server=y,suspend=$SUSPEND,address=$LISTEN_PORT
SBT_OPTS="$JVM_DEBUG $JVM_RUN" sbt "; set javaOptions ++= Seq(\"$JVM_DEBUG\", \"$JVM_RUN\") ; $@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment