title: How to properly use minify maven plugin to minify js and css in Angularjs app?
body: <p>I am trying to minify javascripts and css files in my angularjs app using <a href="https://samaxes.github.io/minify-maven-plugin/" rel="noreferrer">samaxes minify maven plugin</a>. I am able to get all js &amp; css minified and build a war file with maven, but while trying to open app url I get <code>Error: [$injector:unpr] Unknown provider: aProvider &lt;- a</code> and my app does not work.</p>
  
  <p>Below I am providing my pom plugin configuration</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;com.samaxes.maven&lt;/groupId&gt;
      &lt;artifactId&gt;minify-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;1.7.4&lt;/version&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;id&gt;min-js&lt;/id&gt;
              &lt;phase&gt;prepare-package&lt;/phase&gt;
              &lt;goals&gt;
                  &lt;goal&gt;minify&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
      &lt;configuration&gt;
          &lt;charset&gt;UTF-8&lt;/charset&gt;
          &lt;skipMerge&gt;true&lt;/skipMerge&gt;
          &lt;cssSourceDir&gt;myapp/styles&lt;/cssSourceDir&gt;
          &lt;jsSourceDir&gt;myapp/javascript&lt;/jsSourceDir&gt;
          &lt;jsEngine&gt;CLOSURE&lt;/jsEngine&gt;
          &lt;closureLanguage&gt;ECMASCRIPT5&lt;/closureLanguage&gt;
          &lt;closureAngularPass&gt;true&lt;/closureAngularPass&gt;
          &lt;nosuffix&gt;true&lt;/nosuffix&gt;
          &lt;webappTargetDir&gt;${project.build.directory}/minify&lt;/webappTargetDir&gt;
          &lt;cssSourceIncludes&gt;
              &lt;cssSourceInclude&gt;**/*.css&lt;/cssSourceInclude&gt;
          &lt;/cssSourceIncludes&gt;
          &lt;cssSourceExcludes&gt;
              &lt;cssSourceExclude&gt;**/*.min.css&lt;/cssSourceExclude&gt;
          &lt;/cssSourceExcludes&gt;
          &lt;jsSourceIncludes&gt;
              &lt;jsSourceInclude&gt;**/*.js&lt;/jsSourceInclude&gt;
          &lt;/jsSourceIncludes&gt;
          &lt;jsSourceExcludes&gt;
              &lt;jsSourceExclude&gt;**/*.min.js&lt;/jsSourceExclude&gt;
          &lt;/jsSourceExcludes&gt;
      &lt;/configuration&gt;
  
  &lt;/plugin&gt;
  
  &lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.4&lt;/version&gt;
      &lt;configuration&gt;
          &lt;webResources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;${project.build.directory}/minify&lt;/directory&gt;
              &lt;/resource&gt;
          &lt;/webResources&gt;
      &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>Directory structure</p>
  
  <p><img src="https://i.stack.imgur.com/Bkzdc.png" alt="enter image description here"></p>
  
  <p>My controller structure</p>
  
  <pre><code>'use strict';
  
  angular.module('myApp').controller('MyController', function($scope, $filter, $location, $interval, ngTableParams, $modal, $transition, myService, $timeout) {
     ...
  });
  </code></pre>
  
  <p>Chrome console error</p>
  
  <p><img src="https://i.stack.imgur.com/NW5Cb.png" alt="enter image description here"></p>
  
  <p>Does <a href="https://samaxes.github.io/minify-maven-plugin/" rel="noreferrer">samaxes minify maven plugin</a> support minifying angularjs apps or do I need to use any other alternatives? </p>
  
  <p>Please help me in minifying js and css in my angularjs app.</p>