in my project I have a folder called war
. It is initially empty and it's under version control. The folder gets populated by Maven during its package
phase and Eclipse's WST plugin deploys the web app from this folder.
What I want is to delete contents of the war
folder during the clean
phase but not the folder itself. How do I do that? So far I know how to delete the whole war
folder:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<followSymLinks>false</followSymLinks>
<filesets>
<fileset>
<directory>${basedir}/war</directory>
</fileset>
</filesets>
</configuration>
</plugin>
How do I delete only contents of the war
folder but not the folder itself? I know that by adding some existing excludes, the folder won't be deleted. But how to generally delete only contents of a folder?
Add this includes
section to your fileset definition
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>war</directory>
<includes>
<include>**/*</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>