如何从YUI压缩器中排除文件夹

时间:2016-03-01 06:21:34

标签: javascript eclipse maven minify yui-compressor

我想排除一个包含YUI压缩器无法编译的javascript文件的文件夹,并输出错误。我正在使用<exclude>folder</exclude>标记尝试此操作,该标记无效--YUI仍在尝试压缩文件夹中的文件。

以下是我的pom配置:

<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>

知道怎么做到这一点吗?

1 个答案:

答案 0 :(得分:4)

找到解决方案,我在这里发帖,所以每个人都可以看到。对于我的情况,以下工作:

我必须使用<exclude>src/main/webapp/js-max/patterns/*</exclude>而不是<exclude>**/patterns/*</exclude>。所以以下是适合我的完整pom配置:

<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>