This is not a supported means of building Tomcat; this information is
provided without warranty :-).
The only supported means of building Tomcat is with the "ant build"
However, some developers like to work on Java code with a Java IDE,
and the following steps have been used by some developers.
Note that you must complete all the above steps to fetch
dependent libraries and build some JAR files the first time.
After you have completed the above steps, you can set up an
Note that this will not let you build everything under Eclipse;
the build process requires use of Ant for the many stages that aren't
simple Java compilations.
However, it will allow you to view and edit the Java code,
get warnings, reformat code, perform refactorings, run Tomcat
under the IDE, and so on.
Use Windows->Preferences and then Java->Build Path->Classpath
Variables to add two new Classpath variables:
|TOMCAT_LIBS_BASE||the base path where the binary dependencies have been downloaded|
|ANT_HOME||the base path of Ant 1.8.0 or later|
There are two files in the root directory,
eclipse.project. Create their copies with new names,
Use File->Import and chose "Existing Projects into Workspace".
From there import the root directory where you have checked out tomcat.
Eclipse .project and .classpath files provided in the root directory of
tomcat repository should allow Eclipse to find all source trees and jars, and
hopefully compile without problems. Note that these
files assume you are using Eclipse with a 5.0 or later JDK.
To run Tomcat without a special IDE plug-in, you can simply use Run->Run...
enter "org.apache.catalina.startup.Catalina" as the main class,
"start" as program arguments, and
"-Dcatalina.home=..." (with the name of your build directory)
as VM arguments.