I have a Maven project that uses Jetty (pom), it can be run like this:
$ mvn jetty:run
Many developers want to debug it within Eclipse.
QUESTION: What is the most straightforward way to import the project into Eclipse in such a way that it can be debugged as a webapp?
MY ATTEMPT:
- Run
mvn eclipse:eclipseormvn eclipse:eclipse -Dwtpversion=1.5 - In Eclipse, define the
M2_REPOvariable pointing to your Maven directory, for instance/home/nico/.m2/repository - Import > Existing project > Select the project directory > OK
- Check “Dynamic Web Project” then click “Further configuration available…” and enter in “web content” enter “src/main/webapp”. You can not change it afterwards.
I feel it is not far from working, but problem: I don’t see how to tell Eclipse where the jars are.
Is there a better solution than copying all needed jars from the Maven repository to src/main/webapp/WEB-INF/lib manually ?
Note: This question is rather similar but the accepted answer is only a single step of the process.
mvn eclipse:eclipseM2_REPOvariable pointing to your Maven directory, for instance/home/nico/.m2/repositoryNow the app will stop at your breakpoints, go step-by-step when you want, etc.