Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Using the clean goal to trigger plugin actions.

This mini-guide supplements the Build Lifecycle introduction document.

The Introduction to the Build Lifecycle document does not list the "clean" phase because it is not called implicitly when the other phases are called. This is an intended design but no current documentation discusses the possibility of attaching a plugin to the clean phase.

Attaching a plugin to the clean phase is as simple as declaring it in the pom:

Code Block
borderStylesolid
titlePOM plugin section
<plugin>
   <artifactId>maven-antrun-plugin</artifactId>
   <executions>
     <execution>
        <phase>clean</phase>
        <configuration>
           <tasks>
              <!-- run some tasks -->
           </tasks>
        </configuration>
        <goals>
           <goal>run</goal>
        </goals>
     </execution>
  </executions>
</plugin>

The execution above will be called next time the "clean" goal is triggered on the project.