aurelius
aurelius

Reputation: 4076

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.

Upvotes: 5

Views: 4270

Answers (2)

aurelius
aurelius

Reputation: 4076

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>

Upvotes: 3

Essex Boy
Essex Boy

Reputation: 7950

The following works for me

    <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
            <filesets>
                <fileset>
                    <directory>${basedir}/GENERATED_DIR</directory>
                </fileset>
            </filesets>
        </configuration>
    </plugin>

Upvotes: 7

Related Questions