Class CleanMojo

java.lang.Object
org.apache.maven.plugins.clean.CleanMojo
All Implemented Interfaces:
org.apache.maven.api.plugin.Mojo

@Mojo(name="clean") public class CleanMojo extends Object implements org.apache.maven.api.plugin.Mojo
Goal which cleans the build. This attempts to clean a project's working directory of the files that were generated at build-time. By default, it discovers and deletes the directories configured in project.build.directory, project.build.outputDirectory, project.build.testOutputDirectory, and project.reporting.outputDirectory.

Files outside the default may also be included in the deletion by configuring the filesets tag.

Since:
2.0
Author:
Emmanuel Venisse, Martin Desruisseaux
See Also:
  • Constructor Details

    • CleanMojo

      public CleanMojo()
  • Method Details

    • execute

      public void execute()
      Deletes build directories and file-sets. Directories are deleted in the following order:
      1. Build directory (${project.build.directory})
      2. Main classes directory (${project.build.outputDirectory})
      3. Test classes directory (${project.build.testOutputDirectory})
      4. Directories specified in the <targetPath> child of <source> elements
      5. Additional file-sets
      Redundant directories are omitted. For example, the main classes directory will be skipped in the usual case where it is a sub-directory of the build directory.
      Specified by:
      execute in interface org.apache.maven.api.plugin.Mojo
      Throws:
      org.apache.maven.api.plugin.MojoException - if a directory cannot be deleted