Debugging Roo addon is like debugging remote Java application.
  1. Get Roo source code from Roo Git repository
  2. Compile it with 'mvn clean install'
  3. Open the file '%ROO_HOME%\bootstrap\roo-dev.bat' in your favorite text editor
  4. Add the following line somewhere above the line 'rem Hop, hop, hop...'
    Code:
    set REMOTE_DEBUG=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=6055,suspend=n
    The number 6055 is the port debugger will connect to. You can use arbitrary free port here
  5. Insert %REMOTE_DEBUG% inside the command line that bootstraps Roo (the line below 'hop, hop, hop...'). It should look like
    Code:
    java -Djline.nobell=true %ROO_OPTS% -Droo.args="%*" -DdevelopmentMode=true -Dorg.osgi.framework.storage="%ROO_HOME%\bootstrap\target\osgi\cache" -Dfelix.auto.deploy.dir="%ROO_HOME%\bootstrap\target\osgi\bundle" -Dfelix.config.properties="file:%ROO_HOME%\bootstrap\target\osgi\conf\config.properties" %REMOTE_DEBUG% -cp "%ROO_CP%" org.springframework.roo.bootstrap.Main
  6. From Windows command prompt, start Roo shell (roo-dev.bat). Roo should boot normally, displaying an additonal message
    Listening for transport dt_socket at address: 6055
  7. Import Roo source code into STS by using File -> Import.. -> Maven -> Existing Maven Projects
  8. Open STS Debug Configurations window, and double click on Remote Java Application node to create a new debug configuration
  9. Set connection type to Standard (Socket Attach)
  10. Set host to 0.0.0.0
  11. Set port to the same port you specified earlier in REMOTE_DEBUG var
  12. Press Debug button. STS should attach successfully to the running Roo shell application
  13. Open your addon's source code in STS and set one or more breakpoints
  14. Go to Roo shell and invoke your addon command