Web Project’s “lib” Folder Cleanup

Home » Web Project’s “lib” Folder Cleanup » Java » Web Project’s “lib” Folder Cleanup

If your Maven-built Web project has a large number of dependencies or depends on projects whose version number is updated frequently, you may want to cleanup its .../WEB-INF/lib directory. After dabbling quite a bit with bat/bash scripts and some maven plugins I found out that an additional cleanup directory can be included to the Maven Clean Plugin.

Below is the pom.xml excerpt to instruct maven-clean-plugin to delete all .jar files under the project’s .../WEB-INF/lib directory.
[code language=’xml’] <plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>${basedir}/WebRoot/WEB-INF/lib</directory>
<includes>
<include>**/*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
[/code]

Leave a Comment