It is possible to start an application ready for remote debugging by using
the Maven mvnDebug command.
Eclipse or another development
environment can then connect to the running application for remote debugging.
Make sure the project you want to debug has been imported into Eclipse if not
already present there (you may have created the project via the command line rather than
in Eclipse).
Sometimes it is necessary to remote debug an application. For example, if you want
to debug an application running on Linux, but the developer platform is Windows. The
command mvnDebug can be used to start the application in remote
debugging mode, where it will listen on port 8000 for a remote debugger.
- Change into the Maven project directory.
-
Run mvnDebug rather than the mvn
command.
The Maven project will start and listen for a remote debugger on port 8000.
- In Eclipse, select from the main menu.
- Select Maven Build and click the New icon on the top left of the dialog.
- Give the Debug Configuration a suitable name.
- Click Browse Workspace and select the base directory of the project you wish to debug.
- For Goals enter clean install.
- For Profile enter amp-to-war.
- In the Main tab ensure that Debug Output is selected.
- Click Apply.
-
On the JRE tab add the following VM arguments:
-Xms1024m -Xmx4096m -XX:PermSize=1024m -javaagent:/Users/tbedford/Downloads/springloaded-1.2.0.RELEASE.jar -noverify to avoid PermGen exceptions, and to enable Spring Loaded.
- Click Apply.
- Click Debug to run the Debug Configuration.
- In Eclipse, enable the Debug perspective by selecting from the main menu.