views:

198

answers:

6

Hello, I am q java web apps developer. I am using Eclipse+Tomcat. Currently I am working on about 10 web apps.

Here is my problem: My web apps are not all placed under a single folder, they are located in different places.

To test my changes I have to export my web apps into war files or to move the updated files manually every time so the Tomcat will recognize them.

This seems like a waste of time for me.

Is there a way to tell tomcat where my web apps located instead of copying files every time?

+4  A: 

Are you using Eclipse Webtools? If you're not, consider doing so. You will be able to configure Eclipse to launch Tomcat with your web applications, have them auto-reloaded, etc...

Short of that, you could still configure your Tomcat server to pick up your web applications from wherever you want by specifying appropriate document base in either server.xml or your webapp's context.xml

Here's a link to Server Tools documentation

ChssPly76
+2  A: 

Here comes a tutorial telling you how tomcat and eclipse are supposed to work together to forge a development environment.

http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html

Follow it and you will not be exporting the .war all the time.

Winston Chen
A: 

You can try using Ant or Maven. It will solve this problems

Madhu
I assume you meant Maven...
Yuval
A: 

I think you should load your application from context files rather than the server.xml. There is no need to load a application every time in the container. You can run your application from the place where it is. Please use this link

Umesh Aawte
A: 

You don't actually have to use Tomcat to test your apps... You can use the Jetty web server from within Eclipse, which is very comfortable.

Yuval
+1  A: 

You can do this easily with Tomcat. For each app you want run from somewhere else, you need to place a context fragment in $CATALINA_HOME/conf/Catalina/[host] directory. For example,

app1.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="/anywhere/app1" swallowOutput="true">
</Context>

The xml file name will be your context name.

ZZ Coder