Thursday, August 25, 2011

use jetty in eclipse for mvn struts2 web app

by use remote debug,we can use jetty as a web server and change code from eclipse,change will be effect immediately after save,we don't need to restart jetty,here is the step

set up a exteranl tools for current project,location is ${maven_exec},work directory is ${project_loc},${project_loc} is for argument,put environment variable for MAVEN_OPTS as "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n" without start and end quotation mark.
this means jvm used by jetty will use port 4000 for remote debug

then in elcipse setup a debug configuration unser Remote Java application,connection type is Standard (Socket Attach),host is localhost ,port is 4000.

then start jetty,then run debug remote debugger will attach to jetty server,enable build automatically

we can use breakpoint variable watch,
code change will automatically compiled
but things like adding static variables, new domain classes will not work sice they need aware of while class loadup

1 comment:

  1. we can terminate the jetty process from Debug windows,there should be two process,one for jetty(mvn),one for application(Remote Java Application)

    ReplyDelete