Fork me on GitHub

Using include/exclude patterns

This plugin supports include/exclude patterns. When bundling into one file, the order in which the source files were specified is preserved. Specifically:

  • For each include, find all files matching the wildcard pattern (observing the excludes).
  • For each include, sort the matching files alphabetically.
  • Then add the matching files for each include in the order the includes were specified.
    <project>
      <!-- ... -->
      <build>
        <plugins>
          <!-- ... -->
          <plugin>
            <groupId>com.github.blutorange</groupId>
            <artifactId>closure-compiler-maven-plugin</artifactId>
            <version>8.0</version>
            <executions>
              <execution>
                <id>default-minify</id>
                <configuration>
                  <!-- When bundling into one file, first adds prerequisite files, then custom files. -->
                  <includes>
                    <include>**/*Prerequisites.js</include>
                    <include>**/*Custom.js</include>
                  </includes>
                  <excludes>
                    <exclude>**/*.min.js</exclude>
                  </excludes>
                </configuration>
                <goals>
                  <goal>minify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- ... -->
        </plugins>
      </build>
      <!-- ... -->
    </project>