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

How to exclude a folder from YUI compressor

我想排除包含一组 javascript 文件的文件夹,YUI 压缩器不会编译这些文件并输出错误。我正在尝试使用 <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>

知道如何完成这个吗?

找到解决办法了,我发在这里让大家看看。对于我的情况,以下方法有效:

而不是 <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>