2016-03-01 199 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>