Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.1.1
-
Fix Version/s: 2.3
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
We would like to configure clean in our parent pom to remove the log files in logs in all our child modules. We've done that like this:
<plugin> <artifactId>maven-clean-plugin</artifactId> <version>2.1.1</version> <configuration> <filesets> <fileset> <directory>${basedir}/logs</directory> <followSymlinks>false</followSymlinks> <excludes> <exclude>**/.svn</exclude> </excludes> </fileset> </filesets> </configuration> </plugin>
The problem is that when we want to clean an extra directory out of a module, say for example, generated-sources:
<plugin> <artifactId>maven-clean-plugin</artifactId> <version>2.1.1</version> <executions> <execution> <id>gensrc</id> <phase>clean</phase> <goals> <goal>clean</goal> </goals> <configuration> <filesets> <fileset> <directory>generated-sources</directory> <followSymlinks>false</followSymlinks> </fileset> </filesets> </configuration> </execution> </executions> </plugin>
We then see the following when we run "mvn clean":
[INFO] Building Generated Sources
[INFO] task-segment: [clean]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory /Users/jpollak/src/software/projects/mhs/trunk/mhs-gensrc/target
[INFO] Deleting directory /Users/jpollak/src/software/projects/mhs/trunk/mhs-gensrc/target/classes
[INFO] Deleting directory /Users/jpollak/src/software/projects/mhs/trunk/mhs-gensrc/target/test-classes
[INFO] Deleting directory /Users/jpollak/src/software/projects/mhs/trunk/mhs-gensrc/target/site
[INFO] Deleting file-set: /Users/jpollak/src/software/projects/mhs/trunk/mhs-gensrc/logs (included: [], excluded: [**/.svn])
[INFO] [clean:clean {execution: gensrc}]
[INFO] Deleting directory /Users/jpollak/src/software/projects/mhs/trunk/mhs-gensrc/target
[INFO] Deleting directory /Users/jpollak/src/software/projects/mhs/trunk/mhs-gensrc/target/classes
[INFO] Deleting directory /Users/jpollak/src/software/projects/mhs/trunk/mhs-gensrc/target/test-classes
[INFO] Deleting directory /Users/jpollak/src/software/projects/mhs/trunk/mhs-gensrc/target/site
[INFO] Deleting file-set: generated-sources (included: [], excluded: [**/.svn])
[INFO] ------------------------------------------------------------------------
It would be nice to suppress cleaning target a second time.
A workaround is to use the antrun plugin.
Something like this (I have not tested this properly)