vicpow
vicpow

Reputation: 11

The yuicompressor-maven-plugin seems to be ignoring my in exclude/include option

My goal is to only compress certain javascript files within certain directories but the plugin is still traversing my entire directory structure attempting to compress all javascript files. Here is what my pom looks like:

<plugin>
    <groupId>net.alchim31.maven</groupId>
     <artifactId>yuicompressor-maven-plugin</artifactId>
     <version>1.3.0</version>
     <executions>
       <execution>
          <phase>compile</phase>
          <goals>
              <goal>compress</goal>
          </goals>
       </execution>
     </executions>
     <configuration>
       <nosuffix>true</nosuffix>
       <aggregations>
         <aggregation>
            <insertNewLine>true</insertNewLine>  
            <output>${project.build.directory}/${project.build.finalName}/js/analytics/all.js</output>
            <inputDir>${basedir}/src/main/webapp/js/analytics/app</inputDir>
          <includes>        
             <include>${basedir}/src/main/webapp/js/analytics/app/application.js</include>
          </includes>
          <excludes>
            <exclude>all-js-min.js</exclude>
          </excludes>
        </aggregation>
     </aggregations>
   </configuration>
  </plugin>

I'm expecting that it will only look for js files that are located in ${basedir}/src/main/webapp/js/analytics/app and only compress application.js, since that is the only file I specifically included. It also attempts to compress all-js-min.js.
It seems like the include/exclude options are ignored. Any ideas what may be going wrong?

Upvotes: 1

Views: 3333

Answers (1)

amuniz
amuniz

Reputation: 3342

There is a "excludes" option at top config level. Try this:

<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>yuicompressor-maven-plugin</artifactId>
    <version>1.3.0</version>
    <executions>
        <execution>
            <goals>              
                <goal>compress</goal>
            </goals>
            <phase>process-sources</phase>
        </execution>
    </executions>
    <configuration>
        <excludes>
            <exclude>[what you want to exclude]</exclude> 
        </excludes>
        <aggregations>
            <aggregation>
                <removeIncluded>false</removeIncluded>
                <includes>
                    <include>**/[js file name to include 1]</include>
                    <include>**/[js file name to include 2]</include>
                </includes>
                <output>[js file minified]</output>
            </aggregation>
        </aggregations>
    </configuration>
</plugin>

Upvotes: 3

Related Questions