Tuesday, December 29, 2015

Remote debug a Atlassian Stash plugin from Eclipse

While developing a Atlassian Stash plugin, you may need to debug the code using break points in Eclipse. But since the Stash plugin is deployed on a remote web container (though it is in localhost), you can't debug it straight way. You need to establish a remote debug session

Step 1: Run your stash application in debug mode

  • atlas-debug

Step 2: Configure Remote Debug configurations in Eclipse

  • Run -> Debug Configurations -> Remote Java Application -> New 
  • Host = localhost
  • Port = 5005   # This is the debug port. Normal port is 7999

Step 3: Add a break point on your code in eclipse

Step 4: Run 'Debug'

  • Run ->  Debug

Step 5: Invoke your plugin

  • To get an entry to your code in eclipse, you need to touch the part of the application to which your code is related.
  • For example in my case, I went to Pull Requests (coz my plugin was dealing with pull requests) and clicked on one of the pending pull request.

Step 6: Start debug

  • Step Over (F6)  or Step In (F5)

No comments: