Update 12/2017: Nowadays just use a plugin. For Maven I could recommend frontend-maven-plugin, Gradle has gradle-frontend-plugin, or just use plain Node plugin like gradle-node-plugin and do the rest with Node scripts.
Thinking about the nature of things we can sometimes notice that a web application,
depending of course on the level of sophistication, has in fact dualist nature when it comes down to its ontology.
Having too vivid imagination we can relate it to Plato's duality of soul and body,
which in case of web application can be a metaphor. As it is so that from the nature of web app we can derive a
backend is soul, powering the body, but the body is what people see.
Both must be functional, both are equally important (ok, Plato would have disagreed with that,
so let's leave the metaphor here), and they deserve the proper build process. It is very common though that often
the front-end part is mistreated or ignored.