logo Apache Maven Clean Plugin

The Maven Clean Plugin is a plugin that removes files generated at build-time in a project's directory.

homepage: maven.apache.org/plugins
fresh index:
last release: 4 years ago, first release: 2 decades ago
packaging: maven-plugin
get this artifact from: central
see this artifact on: search.maven.org


Display vulnerabilities (snyk): Vulnerability check

This chart shows how much is this artifact used as a dependency in other Maven artifacts in Central repository and GitHub:


select version:

Add this snippet into pom.xml inside tag <project><build><plugins>:




Switch to artifact.
goals:
clean:clean

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.

clean:help

Display help information on maven-clean-plugin. Call mvn clean:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.

Often used code snippets:

<plugin>
  <artifactId>maven-clean-plugin</artifactId>
  <configuration>
    <filesets>
      <fileset>
        <directory>src/gen/java</directory>
        <includes>
          <include>**/*</include>
        </includes>
        <followSymlinks>false</followSymlinks>
      </fileset>
    </filesets>
  </configuration>
</plugin>
<plugin>
  <artifactId>maven-clean-plugin</artifactId>
  <configuration>
    <filesets>
      <fileset>
        <directory>src/gen/java</directory>
        <includes>
          <include>**/*</include>
        </includes>
        <followSymlinks>false</followSymlinks>
      </fileset>
    </filesets>
  </configuration>
  <executions>
    <execution>
      <id>clean-old-generated-docs</id>
      <phase>verify</phase>
      <goals>
        <goal>clean</goal>
      </goals>
      <configuration>
        <excludeDefaultDirectories>true</excludeDefaultDirectories>
        <filesets>
          <fileset>
            <directory>../../../docs/apidocs/store/v1</directory>
            <includes>
              <include>**/*</include>
            </includes>
            <followSymlinks>false</followSymlinks>
          </fileset>
        </filesets>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <artifactId>maven-clean-plugin</artifactId>
  <configuration>
    <filesets>
      <fileset>
        <directory>src/gen/java</directory>
        <includes>
          <include>**/*</include>
        </includes>
        <followSymlinks>false</followSymlinks>
      </fileset>
    </filesets>
  </configuration>
  <executions>
    <execution>
      <id>clean-old-generated-docs</id>
      <phase>verify</phase>
      <goals>
        <goal>clean</goal>
      </goals>
      <configuration>
        <excludeDefaultDirectories>true</excludeDefaultDirectories>
        <filesets>
          <fileset>
            <directory>../../../docs/apidocs/publisher/v1</directory>
            <includes>
              <include>**/*</include>
            </includes>
            <followSymlinks>false</followSymlinks>
          </fileset>
        </filesets>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <artifactId>maven-clean-plugin</artifactId>
  <configuration>
    <filesets>
      <fileset>
        <directory>src/gen/java</directory>
        <includes>
          <include>**/*</include>
        </includes>
        <followSymlinks>false</followSymlinks>
      </fileset>
    </filesets>
  </configuration>
  <executions>
    <execution>
      <id>clean-old-generated-docs</id>
      <phase>verify</phase>
      <goals>
        <goal>clean</goal>
      </goals>
      <configuration>
        <excludeDefaultDirectories>true</excludeDefaultDirectories>
        <filesets>
          <fileset>
            <directory>../../../docs/apidocs/gateway/v1</directory>
            <includes>
              <include>**/*</include>
            </includes>
            <followSymlinks>false</followSymlinks>
          </fileset>
        </filesets>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <artifactId>maven-clean-plugin</artifactId>
  <executions>
    <execution>
      <id>auto-clean</id>
      <phase>initialize</phase>
      <goals>
        <goal>clean</goal>
      </goals>
    </execution>
  </executions>
</plugin>

© Jiri Pinkas 2015 - 2022. All rights reserved! Admin login To submit bugs / feature requests please use this github page
related: JavaVids | Top Java Blogs | Java školení
Apache and Apache Maven are trademarks of the Apache Software Foundation. The Central Repository is a service mark of Sonatype, Inc.