java - Start tomcat7:run maven plugin within eclipse and debug -
i want debug webapp in eclipse. point tomcat , webapp ran inside of eclipse in debug mode, breakpoints in webapp code have no effect.
details
webapp maven artifact , use m2e plugin in eclipse bridge between maven , eclipse.
i've managed start tomcat server within eclipse. webapp started in tomcat nicely, in debug mode if choose so:
- in eclipse, right-click project
- run > maven build... (not "maven build")
- a window opens. in text field "goals", enter "tomcat7:run"
- click apply
- click run
the tomcat server starts running , stdlog printed window within eclipse. can stop conveniently , start again in debug mode. far, that's want , expect.
problem
set breakpoint in code of webapp , restart tomcat in debug mode within eclipse. now, breakpoint isn't active: doesn't have little tickmark active breakpoints have , know code executed, doesn't stop @ breakpoint.
there can 2 ways fix , need 1 or both of them. open run configuration, then
problem+solution 1 (fork)
if tomcat forked in vm, need add parameter forkmode value of never. allows eclipse "look through" tomcat's vm , set breakpoints there.
problem+solution 2 (source)
in setups maven parent , child artifacts, can happen eclipse not aware source of child project belong webapp. symptom of execution stopped @ breakpoint, eclipse not automatically jump source location , instead tells source unknown.
solve this, need add source of child project run configuratuon: in run configuration, go source > add... > java project , pick relevant projects contain source code might want debug.
Comments
Post a Comment