Building Apache Tomcat 8
Apache tomcat is a well known web server among JavaEE developers. Lot of user's tend to download the binary distributions. But if you are interested in building tomcat from the source code then you have visited the right place. Enough chit-chat let's dive in.
Requirements
- JDK 1.7 - Download JDK 1.7
- Apache Ant 1.9.5 or later version - Download Apache Ant
- Tomcat 8 source code - Download source code
Lets get started!
Setting up JDK 1.7
First of all you need to install JDK and set up the environment variable JAVA_HOME. I'm assuming that you might have already done this. If not there are web sites that teaches you this step.
Once you have the next step is setting up Apache Ant.
Apache Ant (Another Neat Tool)
Since we don't come across tools like Apache Ant I'll give you a brief description what it is.
Apache ant is a build tool developed by James Duncan Davidson. It was developed as a solution to problems and compatibility in Apache Make Tool. Apache Ant's primary mission was to support building Apache Tomcat but later it was promoted to a independent project in year 2000. I think that enough for a small talk about Ant.
Once you have downloaded Apache Ant you will have following directories.
(Note: I have downloaded Apache Ant 1.9.7)
then couple of environment variables need to configured.
- ANT_HOME - Create this variable should points to the directory contains Apache Ant
- PATH - Edit this variable,Append the path that points to the bin folder in Apache Ant that you download
Your Downloaded source code file hierarchy should look like this.(Apache Tomcat 8.0.3)
Building and running tomcat needs a some library files. These files are not bundled with the tomcat source code. Therefore before diving into building tomcat we need to set up a folder (area) that holds this library files.
To do so we have to edit "build.properties.default" file. Open the file in a text editor. Find the variable "base.path". And enter the absolute path.(NOTE: the folder doesn't need to created at this step, but make sure you give a legit path)
Building tomcat will require Internet connection. Therefore if you are using proxy settings make sure you do the necessary configurations.
All Set, Let's Build !
We have reached the finish line.. A simple last step,
open command prompt or terminal. move into the directory. and simply type "ant" without quotation marks.
you will see the libraries and packages are downloading, and then compiling and building. Finally the message BUILD SUCCESSFUL.
One last Toast.
I hope that this was helpful to you to understand and follow the steps towards successful build. Comment if you found any issues or any mistakes I've made. Until next time adios amigos!!
Comments