mavenyui-compressor

YUI Compressor Maven Mojo doesn't compress files for package war:war


I just want my files to be compressed when packaging the project into a war file. I'm kinda new to Maven, this is the first plugin for packaging that I'm trying to use.

I followed the instructions from http://alchim.sourceforge.net/yuicompressor-maven-plugin/plugin-info.html and some other questions on this plugin:

My build section has just the basics:

<build>
    <sourceDirectory>src</sourceDirectory>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>net.alchim31.maven</groupId>
          <artifactId>yuicompressor-maven-plugin</artifactId>
          <version>1.1</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        (...)
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        (...)
      </plugin>
      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>yuicompressor-maven-plugin</artifactId>
        <version>1.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>compress</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <nosuffix>true</nosuffix>
        </configuration>
      </plugin>
    </plugins>
  </build>

But when I try to 'mvn package war:war' it doesn't compress anything:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building FCO-novo-layout 0.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ FCO-novo-layout ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ FCO-novo-layout ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ FCO-novo-layout ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ FCO-novo-layout ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ FCO-novo-layout ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.6:war (default-war) @ FCO-novo-layout ---
[INFO] Packaging webapp
[INFO] Assembling webapp [FCO-novo-layout] in [C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\target\FCO-novo-layout-0.0.2-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\WebContent]
[INFO] Webapp assembled in [379 msecs]
[INFO] Building war: C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\target\FCO-novo-layout-0.0.2-SNAPSHOT.war
[INFO]
##########################################################################
##########################################################################
[INFO] --- yuicompressor-maven-plugin:1.1:compress (default) @ FCO-novo-layout ---
[INFO] nb warnings: 0, nb errors: 0
[INFO]
[INFO] --- maven-war-plugin:2.6:war (default-cli) @ FCO-novo-layout ---
[INFO] Packaging webapp
[INFO] Assembling webapp [FCO-novo-layout] in [C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\target\FCO-novo-layout-0.0.2-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\WebContent]
[INFO] Webapp assembled in [969 msecs]
[INFO] Building war: C:\web_prj\ECL_WKSPC_64_MARS_7.17_before_intl_removal\FCO-novo-layout\target\FCO-novo-layout-0.0.2-SNAPSHOT.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.472 s
[INFO] Finished at: 2016-08-11T11:53:58-03:00
[INFO] Final Memory: 15M/217M
[INFO] ------------------------------------------------------------------------

Solution

  • What about run mvn net.alchim31.maven:yuicompressor-maven-plugin:compress on your maven pom directory?