title: Maven plugin for versioning and minifying javascript
body: <h2>Single Page Javascript Application</h2>
  
  <p>I have built a sophisticated ajax-driven single page webapp that uses a RESTful backend web service serving JSON. The javascript is split into many different files, each file representing some sort of feature or component.</p>
  
  <p>While the service has been in <em>alpha</em> testing, I've just be serving all these files separately without minification. But now that I'd like to launch a <em>beta</em> version, I really need to combine files, minify them, and version them. I want to add this to my build process, using Maven.</p>
  
  <h2>Javascript File Types</h2>
  
  <p>I'm using the following "types" of javascript files, of which #3 and #4 are my concerns:</p>
  
  <ol>
  <li>External files, such a jquery and jquery-ui served from the Google CDN. Rarely change these versions, can be handled manually.</li>
  <li>Jquery plugins that I'm hosting myself, such as fullcalendar or ui-layout. Again, I rarely update these to new versions and can handle it manually.</li>
  <li>Application-wide javascript code. Custom javascript that is spread across many files and can change occasionally. All of these files need to be loaded for the app to work.</li>
  <li>Feature-specific javascript code. Custom javascript that is loaded on demand when a specific feature is requested. This code can change quite frequently and is not loaded at startup.</li>
  </ol>
  
  <h2>Build Objectives</h2>
  
  <p>I'd like to do the following during my build process:</p>
  
  <ul>
  <li>Concatenate all type 3 javascript files together, minify them, and save as a single file with a version number. For instance: <code>app-2.0.6.min.js</code>, where 2.0.6 is the maven project version.</li>
  <li>All type 4 files should be individually minified and saved as separate files with version numbers in the name. For instance: <code>feature-abc-56ab32de29.min.js</code>, where 56ab32de29 is the version number of that specific file.</li>
  <li>Update HTML files with <code>&lt;script&gt;</code> tags to point to javascript files with the correct version numbers.</li>
  <li>Update Javscript files that load type 4 feature javascript files to point to the right versions.</li>
  </ul>
  
  <h2>Questions</h2>
  
  <ul>
  <li><p>Is there a maven plugin that will assist with the concatenation?</p></li>
  <li><p>Is there a maven plugin that will assist with the minification? Ideally, I'd like to use Google Closure Compiler, but would work with others if simpler.</p></li>
  <li><p>Is there a maven plugin that will assist with the versioning? </p></li>
  <li><p>Is there a way to have the type 4 javascript files have independent version numbers? Ideally, if a file doesn't change between version 2.0.5 and 2.0.6, there is no need for users to download a new version and their cached version would work fine. I'm using GIT for source control, so would there be a way to use a file's GIT hashcode for versioning?</p></li>
  <li><p>Is there a solution that will compress the javascript that is inline in regular HTML files without killing the HTML?</p></li>
  <li><p>Is there a solution that will compress and version my CSS files as well?</p></li>
  </ul>