I am using YUI maven plugin and I want to know how to compress a specific directory and exclude all others.
In maven I declare src/main/webapp/javascript to get all .js files in this directory but in the output dire开发者_如何学JAVActory all js of application in this directory appear.
Thanks.
Check out the usage page. It contains instructions on how to accomplish such tasks.
Here's your scenario:
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<!-- add excludes here -->
<exclude>**/*.pack.js</exclude>
<exclude>**/compressed.css</exclude>
</excludes>
</configuration>
</plugin>
There is no includes
parameter, so you can't specify only one directory and have all others excluded. However, you can achieve the same functionality by combining the outputDirectory and sourceDirectory parameters.
<configuration>
<!-- select only the directory you want to compress -->
<sourceDirectory>${project.basedir}/src/main/javascript/yourSubDir
</sourceDirectory>
<!-- and send it to the right output directory -->
<outputDirectory>${project.build.outputDirectory}/yourSubDir
</outputDirectory>
</configuration>
精彩评论