I have a maven question.
I have a GWT project which generates a temporary directory gwt-unitCache folder. I'd like to remove it at the end of the build process.
I have got this plugin configuration:
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>src/main</directory>
<includes>
<directory>gwt-unitCache/**</directory>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
<executions>
<execution>
<id>gwt-unitCache</id>
<phase>install</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
This does its job by deleting the automatically generated gwt-unitCache folder under src/main. However, it also removed the target folder which contains the classes and war file.
I don't want the target file to be removed thus I modified the configuration by removing the section:
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>src/main</directory>
<includes>
<directory>gwt-unitCache/**</directory>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
<executions>
<execution>
<id>gwt-unitCache</id>
<phase>install</phase>
</execution>
</executions>
</plugin>
But this time it does not work anymore. The gwt-unitCache is not removed. It looks like the plugin is run at the beginning of the build process rather than at the end.
I am not good at Maven. Can someone help with this? How can I configure it so that:
I use the command: maven clean install
to build it.
Many thanks.
Not tested but maven-clean-plugin
exposes an excludeDefaultDirectories
that could help do the job. Something like:
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>src/main</directory>
<includes>
<directory>gwt-unitCache/**</directory>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
</configuration>
<executions>
<execution>
<id>gwt-unitCache</id>
<phase>install</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
On a side note, I don't see why you need to clear this directory, can't you just ignore it in your SCM?