I am wondering about any "best practices" to integrate a "modern JavaScript build workflow" into a Maven build that produces a WAR artifact.
I have found several maven plugins that handle concatenation and minification:
- WRO4J: https://code.google.com/p/wro4j/wiki/MavenPlugin
- Minify Maven Plugin: https://github.com/samaxes/minify-maven-plugin
- YUI: http://alchim.sourceforge.net/yuicompressor-maven-plugin/
However I am still missing how they fit into a full build workflow, since I think it is mandatory to be able to switch concatenation/minification on and off:
For development I want to build a WAR that does not contain the concatenated/minified resources so that I can conveniently debug. For a production build I want to produce a WAR that contains the concatenated/minified resources.
Additionally for the production build I then have to "rewrite" the script URLs in my html to point to the concatenate/minified version(s) of the script(s).
In the JavaScript world I would use Grunt with different grunt tasks (uglify, usemin) to achieve the above workflow. How can I achieve the same in a Maven build?