I'm doing an app that has jee6 backend (json-based api only) and a lot of client side code. It looks like Single Page Application (this cool buzzword these days).
I'm not sure how to structure my codebase. There are ways I consider
What about the deployment if I go with the first one? I'd have to build another "war" archive from this frontend part and drop it on the server?
I couldn't find any practices people use.
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:
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:
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).