How to deploy WAR to Tomcat (which is server into Eclipse)
Joined: Mar 16, 2008
We need to customised our war file and we need to deploy it into our tomcat which is part of development. We have tomcat as part of Eclipse (server>new server). In normal circumstances, project is auto deploy to tomcat, but how to deploy customised war file to it.
We are trying to customized our development environment. Normally, when we have "dynamic web proj" in eclipse, it is automaticall deploy to local server. What we want to do is, when developer invoke particular task into his dev environment, it will compile, copy/move some files (like .properties file, img files,xml) to required directory structure and deploy it to local tomcat (of eclipse). Same way, developer, invoke particular task (different then the above), it will do the same thing, but generate war file which he can deploy to standalone server for further testing. We also like to add some task for testing different modules and make them part of deployment/war generation process.
First, Eclipse is a development environment. Each developer uses Eclipse and does development and testing in what ever way works best for them, including deploying to their local app server.
Once code is written, tested and meets our various coding guidelines, the developer checks the changes into a central source code repository.
Then a continuous integration service (Hudson) does a build and test and deploys to a system test machine. There is another automated process that on a push-button deploys the app to production. In all cases, we use Maven and/or Ant to do our builds, testing and deployment.
We NEVER deploy from Eclipse into either the system/integration test or production environment - that is just asking for trouble.
(Your original post might have been Eclipse centric, but notice how I deftly turned it into an Ant/Maven-centric post! )
Joined: Mar 16, 2008
I agreed with you regarding automation for testing deployment on different server. But we are still in initial stage and our current requirent is not that much (or we cann't afford that number of servers). Basically, we have to follow slightly different directory structures like seperate location for label properties file, seperate location for error message properties file, seperate location for config properties files etc. If we follow default structure of "dynamic web project" then we must have to put files at their repsective location. If we can tweak it then it is more better and helpful for team to manage.
That's reason, we need to make custom build in Dev environment so when developer build, it will move/copy files from respective location and generate required deployment structure into local server.
When running you web application from inside Eclipse - it runs in your local Tomcat server (not located inside Eclipse).
If you know how a WAR file look like inside, then you just have to build it with maven and/or ant, and then deploy it in your local Tomcat server - now how or where is a WAR deployed inside Tomcat ?? - hint: look in the root of your local tomcat, and there you should find a 'webapps' folder.