2016-03-01 213 views
4

我想排除一个包含YUI压缩程序无法编译和抽出错误的一组JavaScript文件的文件夹。我正在尝试使用<exclude>folder</exclude>标签,该标签不起作用 - YUI仍在尝试压缩文件夹中的文件。如何排除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

在该职位取一个战利品:http://stackoverflow.com/questions/11836599/usage-of-yui-compressor- maven-mojo-minifying-javascript – Tunaki

+0

@Tunaki谢谢队友,我找到了解决方案:) –

回答

2

找到了解决方案,我在这里发布,以便大家可以看到。对我而言,以下工作:

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