<plugin>
<!-- YUI Compressor Maven, compress1主要压缩不经修改的静态资源,例如引入的静态资源-->
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.5.1</version>
<executions>
<execution>
<id>compress1</id>
<phase>compile</phase>
<goals>
<goal>compress</goal>
</goals>
<configuration>
<!-- 读取js文件采用UTF-8编码 -->
<encoding>UTF-8</encoding>
<!-- 不显示js可能的错误 -->
<jswarn>false</jswarn>
<!-- 若存在已压缩的文件,会先对比源文件是否有改动。有改动便压缩,无改动就不压缩 -->
<force>false</force>
<!-- 在指定的列号后插入新行 -->
<linebreakpos>-1</linebreakpos>
<!-- 压缩之前先执行聚合文件操作 -->
<preProcessAggregates>false</preProcessAggregates>
<!-- 是否忽略execution -->
<skip>false</skip>
<!-- 没有文件后缀 -->
<nosuffix>true</nosuffix>
<!-- 文件后缀 -->
<suffix>.min</suffix>
<!-- 源目录,即需压缩的根目录 -->
<sourceDirectory>${webAppPath}/static/assets</sourceDirectory>
<!-- 压缩js -->
<includes>
<include>js/**/*.js</include>
<include>css/**/*.css</include>
</includes>
<excludes>
<exclude>**/*bak.js</exclude>
<exclude>**/*min.js</exclude>
<exclude>**/*min.css</exclude>
</excludes>
<!-- 压缩后输出文件目录 -->
<outputDirectory>${webAppPath}/release/assets_tmp</outputDirectory>
</configuration>
</execution>
<!-- compress2主要压缩经常修改的静态资源,例如自己编写的静态资源-->
<execution>
<id>compress2</id>
<phase>process-classes</phase>
<goals>
<goal>compress</goal>
</goals>
<configuration>
<!-- 读取js文件采用UTF-8编码 -->
<encoding>UTF-8</encoding>
<!-- 不显示js可能的错误 -->
<jswarn>false</jswarn>
<!-- 若存在已压缩的文件,会先对比源文件是否有改动。有改动便压缩,无改动就不压缩 -->
<force>false</force>
<!-- 在指定的列号后插入新行 -->
<linebreakpos>-1</linebreakpos>
<!-- 压缩之前先执行聚合文件操作 -->
<preProcessAggregates>false</preProcessAggregates>
<!-- 是否忽略execution -->
<skip>false</skip>
<!-- 没有文件后缀 -->
<nosuffix>true</nosuffix>
<!-- 文件后缀 -->
<suffix>.min</suffix>
<!-- 源目录,即需压缩的根目录 -->
<sourceDirectory>${webAppPath}</sourceDirectory>
<!-- 压缩js -->
<includes>
<include>static/jssrc/**/*.js</include>
<include>h5/**/*.js</include>
</includes>
<!-- 不压缩的js -->
<excludes>
<exclude>**/*bak.js</exclude>
<exclude>**/*min.js</exclude>
<exclude>**/*min.css</exclude>
</excludes>
<!-- 压缩后输出文件目录 -->
<outputDirectory>${webAppPath}/release</outputDirectory>
<!-- 聚合文件 -->
<!-- <aggregations> <aggregation> <insertNewLine>false</insertNewLine>
<inputDir>${basedir}/src/main/webapp/release</inputDir> <output>${basedir}/src/main/webapp/release/static/jssrc/front/quote/quote-all.js</output>
<includes> <include>static/jssrc/front/quote/**/*.js</include> </includes>
</aggregation> </aggregations> -->
</configuration>
</execution>
</executions>
</plugin>