In my project I originally made a mistake and committed the target directory in the cvs repository; I know there is no safe way to remove a directory from CVS, so I put a .cvsignore file there to basically ignore everything (I don't want developers who aren't able to even merge properly to commit their classes...).
The problem raises with my Jenkins CI, because I run clean and test goals; basically clean is run before CVS update, so it always finds a file to update (the .cvsignore that has been wiped by clean) and triggers an often useless build.
I think the way to go is to use exclusions but I tried and did not work:
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting file set: **************************/target (included: [**], excluded: [])
The exclusion is configured as:
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>not-clean</id>
<configuration>
<filesets>
<fileset>
<directory>target</directory>
<excludes>
<exclude>*cvsignore</exclude>
</excludes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
<phase>initialize</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>