Remove directory with maven-clean-plugin

18.4k views Asked by At

Can I delete directory with maven-clean-plugin?

The following configuration deletes files from the given directory but the directory itself will be remained:

<plugin>
    <artifactId>maven-clean-plugin</artifactId>
    <version>2.4.1</version>
    <configuration>
        <filesets>
            <fileset>
                <directory>src/main/javascript/node_modules</directory>
                <includes>
                    <include>**/*</include>
                </includes>
                <followSymlinks>false</followSymlinks>
            </fileset>
        </filesets>
    </configuration>
</plugin>

I have checked the plugin's documentation but I can not see any way to delete the directory: http://maven.apache.org/plugins-archives/maven-clean-plugin-2.6.1/clean-mojo.html

I need to delete the directory as well.

2

There are 2 answers

0
zappee On BEST ANSWER

Finally I have figured out what is the solution. The file pattern what I used was wrong.

The following file mask deletes files from the given directory but the folder will be remained:

<include>**/*</include>

This pattern deletes the directory as well:

<include>**</include>
3
Neha Prakash On

Use true for 'excludeDefaultDirectories>'in configuration tag. maven plugin version should not be less than 2.3

<excludeDefaultDirectories>true</excludeDefaultDirectories>