IMPORTANT: This is a supported means of building Tomcat; This information is provided without warranty:-). The only supported means of building Tomcat are with the Ant build described above. However, some developers like to work on Java code with a Java IDE, and the following steps has been used by some develop ERs.
Note: This won't let you build everything under Eclipse; The build process requires use of Ant for the many stages this aren ' t simple Java compilations. However, it'll allow your to view and edit the Java code, get warnings, reformat code, perform refactorings, run Tomcat u NDEr the IDE, and so on.
WARNING: Forget to create and configure the ${tomcat.source}/build.properties
file as described above before running any Ant targets.
Sample Eclipse project files and launch targets is provided in the res/ide-support/eclipse
directory of the source tree. The instructions below would automatically copy these into the required locations.
An Ant target was provided as a convenience to download all binary dependencies, and to create the Eclipse project and Clas spath files in the root of the source tree.
cd ${tomcat.source}
ant ide-eclipse
Start Eclipse and create a new Workspace.
Open the Preferences dialog and then select java->build path->classpath Variables to add new C4>classpath Variables:
Tomcat_libs_base |
The same location base.path build.properties as the setting in, where the binary dependencies has been downloaded |
Ant_home |
The base path of Ant 1.8.1 or later |
Use file->import and choose Existing Projects into Workspace. From there choose the root directory of the Tomcat source tree ( ${tomcat.source}
) and import the Tomcat project located there.
start-tomcat
and launch configurations is provided in and would be available in the stop-tomcat
res/ide-support/eclipse
run->run configurations dia Log. Use these to start and stop Tomcat from Eclipse.
If you want to configure these yourself (or is using a different IDE) then use org.apache.catalina.startup.Bootstrap
as the main class, start
/ stop
etc. As program arguments, and specify -Dcatalina.home=...
(with the name of your build directory) as VM arguments.
Tweaking a few formatting preferences would make it much easier to keep consistent with Tomcat coding conventions (and has Your contributions accepted):
Edit, Formatter, Java---Code Style-- |
Tab Policy:spaces only Tab and Indentation Size:4 |
Text Editors, Editors, General |
Displayed Tab Width:2 Insert Spaces for tabs Show whitespace characters (optional) |
Editor, XML Files, XML |
Indent using spaces Indentation Size:2 |
Formatter, Editor, Ant |
Tab Size:2 Use tab character instead of spaces:unchecked |