user1082748
user1082748

Reputation: 365

Package HTML, CSS, JS in Jar or ZIP

Is it possible to either pack only html, css and JS files in jar (no java binaries) which would then be packed into war for deployment to Tomcat?

or

Can I pack html, css, js files (no java classes) into a zip and pack it into a war for deployment to Tomcat? With this option, would Tomcat unpack the zip as needed?

Upvotes: 0

Views: 1264

Answers (1)

Stewart
Stewart

Reputation: 18303

If you are deploying to Tomcat (and there is presumably some java or JSP code associated with this) then you should use a .war file.

To incorporate purely web assets into the building of a .war, then you need to use an "overlay". There are various Maven plugins and Ant tools which do specifically this.

However, one other possible consideration, is to deploy your web assets directly to your HTTP server (ie. Apache) and then configure it to serve /css/*, /js/*, etc, from there, and every other request can be forwarded to Tomcat.

Upvotes: 1

Related Questions