Fork me on GitHub

Basic Configuration

The only requirement for Closure Compiler Maven Plugin to run is to have source files to process.

By default, all source files are minified and merged into one file. You change this behavior with the options skipMerge and skipMinify.

Also, the name of the output file defaults to script.min.js. To change this, use the option outputFilename.

<project>
  <!-- ... -->
  <build>
    <plugins>
      <!-- ... -->
      <plugin>
        <groupId>com.github.blutorange</groupId>
        <artifactId>closure-compiler-maven-plugin</artifactId>
        <version>${closure-compiler-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>default-minify</id>
            <configuration>
              <!-- List of files to include in the minification process -->
              <includes>
                <include>file-1.js</include>
                <!-- ... -->
                <include>file-n.js</include>
              </includes>
            </configuration>
            <goals>
              <goal>minify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- ... -->
    </plugins>
  </build>
  <!-- ... -->
</project>