You may remember that I have written a post on how to debug an extension. This post is about to explain how to do the same for an Alfresco extension. In fact the principle is the same. To set Alfresco in a debug mode, edit the tomcat/bin/ file and change the last line into:

exec "$PRGDIR"/"$EXECUTABLE" jpda start "$@"

The next time Alfresco is started it will be listening on the 8000 port. Then you will be able to set up the Eclipse debugging session in the same way than the one I described in the post on OOo extension debugging.

To avoid lengthy Alfresco restarts when you change some code, you can unset the automatic build, and use the Project > Build All menu for a hot replace of code. This doesn't work when you have changed the signature of a method or of a class. There are some cases where it doesn't work... but I still haven't identified why it sometimes fails. I only have noticed that you shouldn't change code when the debug session isn't running or when you are stepping in the code.