Usage

Without pom.xml change

To Compress every js and css files :

 $> mvn net.alchim31.maven:yuicompressor-maven-plugin:compress
 
with the -X option compressed file are listed.

To force compress every js and css files and fail if warning :

 $> mvn net.alchim31.maven:yuicompressor-maven-plugin:compress \
     -Dmaven.yuicompressor.force=true \
     -Dmaven.yuicompressor.failOnWarning=true \
 

With pom.xml change

To Compress every js and css files at process-resources phase (before compile) :

<project>
...
  <build>
    <plugins>
...
      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>yuicompressor-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>compress</goal>
            </goals>
          </execution>
        </executions>        
      </plugin>
...
    </plugins>
  </build>
...
</project>
 

To Compress every js and css files but without renaming with suffix :

<project>
...
  <build>
    <plugins>
...
      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>yuicompressor-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>compress</goal>
            </goals>
          </execution>
        </executions>        
        <configuration>
          <nosuffix>true</nosuffix>
        </configuration>
      </plugin>
...
    </plugins>
  </build>
...
</project>
 

To Compress every js and css files except already compressed files like *.pack.js files and compressed.css :

<project>
...
  <build>
    <plugins>
...
      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>yuicompressor-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>compress</goal>
            </goals>
          </execution>
        </executions>        
        <configuration>
          <excludes>
            <exclude>**/*.pack.js</exclude>
            <exclude>**/compressed.css</exclude>
          </excludes>
        </configuration>
      </plugin>
...
    </plugins>
  </build>
...
</project>