I have tried many variants but could not make this work. One example (child pom.xml
):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>target</directory>
<useDefaultExcludes>true</useDefaultExcludes>
<excludes>
<exclude>myFolder</exclude>
</excludes>
</fileset>
</filesets>
</configuration>
</plugin>
Maven always tries to delete my folder. Why?
As also suggested by @AR.3 in the answer here, the
clean
phase and goal would -Still, if you want to exclude a specific folder from being deleted you can follow the inverse approach(a simple hack) to do it as follows -
More about
excludeDefaultDirectories
from a similar link -EDIT
It is indeed possible to exclude a specific folder from being deleted using a direct approach: