membersound
membersound

Reputation: 86925

How to deploy a WebContent folder to tomcat?

I have a simple project in eclipse that only contains a WebContent folder with dynamic html pages (javascript, jquery, css etc).

How can I deploy such a project (that does not have a war file) to a Tomcat?

Upvotes: 0

Views: 1927

Answers (1)

Mark Thomas
Mark Thomas

Reputation: 16660

A WAR file is just a .zip with a different extension. You just need to make sure there is no top level folder within the .zip. Your files need to be in the root of the archive.

To deploy your static files you can either create a directory (the name of the directory will become the context path - use ROOT for the default web application) and copy your files to that directory. Alternatively, zip everything up, change the extension to .war and copy that to the webapps directory. The name of the WAR file (minus the .war extension) becomes the context path.

There are numerous edge cases and details associated with the above. For the full details, see the Tomcat docs: http://tomcat.apache.org/tomcat-8.0-doc/config/host.html#Automatic_Application_Deployment including the links on naming and expected behaviour.

Upvotes: 1

Related Questions