There are two ways to use Maven and Eclipse :
1. Use Eclipse as the editor, and Maven command line for commands, or
Use the first one if you're much more comfortable with using the command line for your maven executionsMaven tasks, but would like to take advantage of eclipseEclipse' features ( code complete, refactoring, etc ). Use the second one if you want eclipse Eclipse to handle all these things - creation to editing to execution.
To do so, you must install an eclipse Eclipse plugin for maven, see Eclipse Integration.
From your command line, append the following to your maven command.
For example, to debug the tests run by the maven Maven lifecycle
mvn install -Dmaven.surefire.debug
Wait for maven Maven to pause its execution and display the message,
Listening for transport dt_socket at address: 5005
Select break points in the code you're are going to run.
Run maven Maven in debug mode, e.g
At line 30, you'll find this,
@REM set MAVEN_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
Uncommenting the line by deleting
in the :end section, otherwise the debug will be turned on even when you run the normal mvn.bat
Save that file as
mvn-debug.bat (or any convenient name you may want). You now have two maven Maven batch files, one for normal use, and one for debugging.
However there is no way to determine which version Maven is using as this is handled by the plexus Plexus classworld's class loader.
1. Because maven-surefire-plugin forks a new JVM by default, thus, the your MAVEN_OPTS are not passed. There are three fork modes of maven-surefire-plugin: Once (default), Never, and Always. For Once mode, surefire will run another JVM and will do all its testing there. For Never, it will use the same JVM instance as that of maven (this is normally not use so that you can isolate your tests). But if you really want to isloate isolate your tests, run in Always mode. This will run a new JVM instance for every test sets it runs.