leonardo luz
leonardo luz

Reputation: 1

YUI source directory filter

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 directory all js of application in this directory appear.

Thanks.

Upvotes: 0

Views: 1464

Answers (1)

Sean Patrick Floyd
Sean Patrick Floyd

Reputation: 298898

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>

Upvotes: 6

Related Questions