Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add information about suspend=y

...

How do I start hacking Tomcat in Eclipse?

Briefly:

No Format

$ git clone https://github.com/apache/tomcat.git
  (or whatever branch you want: clearly, this would be better
  to do directly from within Eclipse but it's easier to describe
  as a command)

$ cd tomcat

$ echo "base.path=/path/to/where/tomcat/can/put/its/3rd-party/libs" > build.properties

$ ant ide-eclipse

Then, in Eclipse, go to Preferences | Java/Build Path/Classpath Variables and set the following variables:

No Format

ANT_HOME=path to your Ant install (where lib/ant.jar can be found)
TOMCAT_LIBS_BASE=[whatever you set base.path to above]

...

The port does not need to be set to 8000, it may be any value appropriate for your system.

If you need to debug Tomcat startup or the auto-deployment of an application (where a breakpoint set in a debugger would be reached before you have time to connect with the debugger), then set the parameter suspend=y instead of suspend=n. Doing this will cause the JVM to pause execution very early in the launch process and wait until a debugger is attached before proceeding.

Whilst this is very useful in development it should not be used in production because of both security and performance implications.

...