Fork me on GitHub

Eclipse m2e integration

This plugin supports Eclipse m2e maven integration. By default, it runs on incremental builds. This means that everytime you change and save a relevant source JavaScript file, the minified / bundled files are recreated. The plugin checks whether a relevant source file was changed and won't run if you just edited a Java file etc.

To turn of this behavior and have the plugin run only when doing a manual full build, use the skipRunOnIncremental option:

<project>
  <!-- ... -->
  <build>
    <plugins>
      <!-- ... -->
      <plugin>
        <groupId>com.github.blutorange</groupId>
        <artifactId>closure-compiler-maven-plugin</artifactId>
        <version>${closure-compiler-maven-plugin.version}</version>
        <configuration>
          <!-- ... -->
          <skipRunOnIncremental>true</skipRunOnIncremental>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <!-- ... -->
</project>

Please note that technically, the plugin is still executed on every incremental build cycle, but skips any processing and should not take any time. If you need to turn off the plugin completely, use the lifecycle-plugin:

<project>
  <!-- ... -->
  <build>
    <plugins>
      <!-- ... -->

      <!-- For Eclipse / M2E integration: If you do not want to run the plugin automatically when a JS resource changes. -->
      <plugin>
        <groupId>org.eclipse.m2e</groupId>
        <artifactId>lifecycle-mapping</artifactId>
        <version>1.0.0</version>
        <configuration>
          <lifecycleMappingMetadata>
            <pluginExecutions>
              <pluginExecution>
                <pluginExecutionFilter>
                  <groupId>com.github.blutorange</groupId>
                  <artifactId>closure-compiler-maven-plugin</artifactId>
                  <versionRange>[2.0.0,)</versionRange>
                  <goals>
                    <goal>minify</goal>
                  </goals>
                </pluginExecutionFilter>
                <action>
                  <ignore />
                </action>
              </pluginExecution>
            </pluginExecutions>
          </lifecycleMappingMetadata>
        </configuration>
      </plugin>

      <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>
              <includes>
                <include>myfiles.js</include>
              </includes>
            </configuration>
            <goals>
              <goal>minify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- ... -->
    </plugins>
  </build>
  <!-- ... -->
</project>