How to remotely deploy web application to Apache Tomcat in Eclipse
In my situation, I am going to develop a web application for running on a a web application like Apache Tomcat. The main IDE is Eclipse for sure. The problem is that development PCs are very old and have not much physical memory. It is not possible to run both Eclipse and Tomcat on these PCs. As a result, they will share a centralized Tomcat server for running in development process. That means the web application must be deployed on remote server instead of the localhost. All developers are not familiar to this infrastructure especially when remote server is Linux and their PCs are all Microsoft Windows XP. I am responsible to find the easiest solution.
There are several approaches to deploy web application on remote server, e.g., ftp, ssh, rsync, and etc. However, all of these approaches are unable to apply using Eclipse. They are also required developers to understand how it works to efficiently and correctly deploy new codes oftenly. Fortunately, Tomcat offers a programmatic approach which is also able to integrate with Eclipse to simplify deployment process to just a few click. The necessary component is Apache Ant which is available in Eclipse by default.
Ant's build file is just an XML with appropriate targets and settings. In addition to Ant, I also need to have the deployer for Apache Tomcat. In summary, below is my procedures to prepare everything for remote deployment.
-
Download the correct deployer for your Tomcat
-
Extract it somewhere, e.g.
C:\Program Files\java
. You will have the deployer inC:\Program Files\java\apache-tomcat-5.5.20-deployer
. -
Create
build.xml
as follows.Above
build.xml
assumes as follows.- Project name "TestProject"
- Context "/TestProject"
- Manager URL "http://192.168.141.129:8080/manager"
- Username "admin"
- Password "password"
- Deployer lib "C:/Program Files/java/apache-tomcat-5.5.20-deployer/lib"
-
Modify
tomcat-users.conf
to have a user with role admin and manager.
That's all. I am able to build a war file and then deploy it via Ant in Eclipse.
Tags: eclipse, remote deploy, linux, tomcat
- sugree's blog
- 2298 reads
Post new comment