调试SpringRoo 插件
-
Debugging Roo addon is like debugging remote Java application.
- Get Roo source code from Roo Git repository
- Compile it with 'mvn clean install'
- Open the file '%ROO_HOME%\bootstrap\roo-dev.bat' in your favorite text editor
- 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
- 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
- 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 - Import Roo source code into STS by using File -> Import.. -> Maven -> Existing Maven Projects
- Open STS Debug Configurations window, and double click on Remote Java Application node to create a new debug configuration
- Set connection type to Standard (Socket Attach)
- Set host to 0.0.0.0
- Set port to the same port you specified earlier in REMOTE_DEBUG var
- Press Debug button. STS should attach successfully to the running Roo shell application
- Open your addon's source code in STS and set one or more breakpoints
- Go to Roo shell and invoke your addon command