In my project, module C has parent B which has parent A.
parent A pom
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
parent B pom
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>clean-extra-files</id>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<filesets>
<fileset>
<directory>C:\foo\bar</directory>
<includes>
<include>foo*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
module C pom
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>clean-extra-files</id>
<phase>pre-integration-test</phase>
</execution>
</executions>
</plugin>
When I run mvn clean pre-integration-test
[INFO] --- maven-clean-plugin:3.0.0:clean (clean-extra-files) @ foo-c ---
[INFO] Deleting C:\dev\workspace\foo-a\foo-b\foo-c\target
[INFO] Deleting C:\foo\bar (includes = [foo*.jar], excludes = [])
Both the default target directory and my additional directory are cleaned. However, I only want the additional directory cleaned.
How do I prevent clean-extra-files
from cleaning the default target directory?
If it is not possible, what other options are there for cleaning up unwanted files?
Env: Java:6, Eclipse:Luna, Maven:3.2