I would leave your Javascript and CSS package with the WAR and use something like Wro4J (I have my own asset pipeline code I can share at some point).
Heres why:
- To ease development you'll want the Javascript/CSS to refresh when you edit them while you run your servlet container. Maven, Eclipse (and/or JRebel) resource refresher will not work with weird package management.
- There isn't really any thing like a WAR/JAR for Javascript/CSS only minification (Require.js and JAM are more for dependency loading).
The reason you have separate Java code in separate projects/jars is to avoid coupling, improve reuse, and increase cohesion. What your trying to do for separation is mainly for cohesion. In large part you don't need to separate the Javascript from your Web App because its already probably very separate from the Java and is a completely different language/runtime.
However I can understand if you say wanted to CDN your JS/CSS and why separating the code might be easier for experimenting.
Here are two options:
- Git's submodules and have the Javascripts and CSS as separate projects that are submodules to your WAR project.
- Have two WAR projects. One with your backend Java code and another with your frontend code. You'll need a container that supports multiple WARS and you will have worry about managing the dreaded servlet container context path.
I have actually done number #2 (laugh at that one) at a previous company I worked for. It worked pretty well. However now days I prefer #1 for its quickness and ease (laugh at that one).