mavenmaven-clean-plugin

How to delete a folder at maven clean phase?


I want do delete a folder at clean phase.

I have used maven-clean-plugin and successfully deleted all of the files under it.

        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>3.0.0</version>

            <configuration>
                <filesets>
                    <fileset>
                        <directory>GENERATED_DIR</directory>
                        <includes>
                            <include>**/*</include>
                        </includes>
                        <followSymlinks>false</followSymlinks>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>

I want to delete "GENERATED_DIR" as well.


Solution

  • This finally worked for me

            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${basedir}</directory>
                            <includes>
                                <include>**/GENERATED_DIR/**</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>