Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude a folder from YUI compressor

I want to exclude a folder containing a set of javascript files that YUI compressor would not compile and pump out errors. I am trying this with the <exclude>folder</exclude> tag, which is not working - YUI is still trying to compress the files in the folder.

Below is my pom configuration:

<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>yuicompressor-maven-plugin</artifactId>
    <version>1.5.1</version>
    <executions>
        <execution>
            <id>compressyui</id>
                <phase>process-resources</phase>
                <goals>
                    <goal>compress</goal>
                </goals>
                <configuration>
                    <nosuffix>true</nosuffix>
                    <warSourceDirectory>src/main/webapp</warSourceDirectory>
                    <jswarn>false</jswarn>
                    <sourceDirectory>src/main/webapp/js-max</sourceDirectory>
                    <webappDirectory>src/main/webapp</webappDirectory>
                    <outputDirectory>src/main/webapp/js</outputDirectory>
                    <force>true</force>
                    <excludes>
                          <!-- yuicompressor fails to compile patterns library, hence stopping full build -->
                          <!-- We won't be modifying this library so will exclude it for now -->
                          <exclude>src/main/webapp/js-max/patterns/*</exclude>
                    </excludes>
                </configuration>
        </execution>
    </executions>
</plugin>

Any idea how to accomplish this?

like image 290
Joel Min Avatar asked Mar 01 '16 06:03

Joel Min


Video Answer


1 Answers

Found the solution, and I'm posting here so everyone can see. For my case, the following worked:

Instead of <exclude>src/main/webapp/js-max/patterns/*</exclude>, I had to use <exclude>**/patterns/*</exclude>. So the following is the complete pom config that worked for me:

<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>yuicompressor-maven-plugin</artifactId>
    <version>1.5.1</version>
    <executions>
        <execution>
            <id>compressyui</id>
            <phase>process-resources</phase>
            <goals>
                <goal>compress</goal>
            </goals>
            <configuration>
                <nosuffix>true</nosuffix>
                <warSourceDirectory>src/main/webapp</warSourceDirectory>
                <jswarn>false</jswarn>
                <sourceDirectory>src/main/webapp/js-max</sourceDirectory>
                <webappDirectory>src/main/webapp</webappDirectory>
                <outputDirectory>src/main/webapp/js</outputDirectory>
                <force>true</force>
                <excludes>
                      <!-- yuicompressor fails to compile patterns library, hence stopping full build -->
                      <!-- We won't be modifying this library so will exclude it for now -->
                      <exclude>**/patterns/*</exclude>
                </excludes>
            </configuration>
    </execution>
</executions>

like image 198
Joel Min Avatar answered Oct 10 '22 11:10

Joel Min