title: Spring boot minify javascript
body: <p>I'm looking for maven config to minify js/css files for a spring boot application.
  For a normal java web app the following config works</p>
  
  <pre><code>            &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;net.alchim31.maven&lt;/groupId&gt;
                      &lt;artifactId&gt;yuicompressor-maven-plugin&lt;/artifactId&gt;
                      &lt;version&gt;1.5.1&lt;/version&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;compress&lt;/goal&gt;
                              &lt;/goals&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                      &lt;configuration&gt;
                          &lt;nosuffix&gt;true&lt;/nosuffix&gt;
                          &lt;webappDirectory&gt;${project.build.directory}/min&lt;/webappDirectory&gt;
                          &lt;excludes&gt;
                              &lt;exclude&gt;**/*-min.js&lt;/exclude&gt;
                              &lt;exclude&gt;**/*.min.js&lt;/exclude&gt;
                              &lt;exclude&gt;**/*-min.css&lt;/exclude&gt;
                              &lt;exclude&gt;**/*.min.css&lt;/exclude&gt;
                          &lt;/excludes&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
                  &lt;plugin&gt;
                      &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                      &lt;configuration&gt;
                          &lt;webResources&gt;
                              &lt;resource&gt;
                                  &lt;directory&gt;${project.build.directory}/min&lt;/directory&gt;
                              &lt;/resource&gt;
                          &lt;/webResources&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
  </code></pre>
  
  <p>But when I try this with spring boot</p>
  
  <pre><code>&lt;profile&gt;
              &lt;id&gt;prod&lt;/id&gt;
              &lt;build&gt;
                  &lt;plugins&gt;
                      &lt;plugin&gt;
                          &lt;groupId&gt;net.alchim31.maven&lt;/groupId&gt;
                          &lt;artifactId&gt;yuicompressor-maven-plugin&lt;/artifactId&gt;
                          &lt;version&gt;1.5.1&lt;/version&gt;
                          &lt;executions&gt;
                              &lt;execution&gt;
                                  &lt;goals&gt;
                                      &lt;goal&gt;compress&lt;/goal&gt;
                                  &lt;/goals&gt;
                              &lt;/execution&gt;
                          &lt;/executions&gt;
                          &lt;configuration&gt;
                              &lt;nosuffix&gt;true&lt;/nosuffix&gt;
                              &lt;webappDirectory&gt;${project.build.directory}&lt;/webappDirectory&gt;
                              &lt;excludes&gt;
                                  &lt;exclude&gt;**/*-min.js&lt;/exclude&gt;
                                  &lt;exclude&gt;**/*.min.js&lt;/exclude&gt;
                                  &lt;exclude&gt;**/*-min.css&lt;/exclude&gt;
                                  &lt;exclude&gt;**/*.min.css&lt;/exclude&gt;
                              &lt;/excludes&gt;
                          &lt;/configuration&gt;
                      &lt;/plugin&gt;
                      &lt;plugin&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                          &lt;configuration&gt;
                          &lt;excludes&gt;
                          &lt;exclude&gt;**/*.js&lt;/exclude&gt;
                          &lt;/excludes&gt;
                          &lt;/configuration&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;repackage&lt;/goal&gt;
                              &lt;/goals&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
  </code></pre>
  
  <p>now spring-boot-maven plugin configuration does not have a way to specify webResources directory.</p>
  
  <p>When the compress goal runs it minifies the js and css. Then the repackage goal just overwrites the minified scripts/css with the uncompressed versions during copying webapp resources phase. Is there a way to skip the copy step or to run the compress goal after the copying step?
  Basically is can I compress css/scripts during a spring boot build?</p>