Typically a nice looking web application would host plenty of icons in its document directories. Personally I use icons from the tango desktop project a lot. It is a library of hundreds of useful icons in multiple sizes.

So I would pull these file into my web project every time I create a new one and update these files as new tango version are released. This is not very handy as it is hard to synchronize these icons. On top of that code repository operations really slow down when checking out from or committing to the repository (just like it is with jars in the WEB-INF/lib folder).

As I have used Maven now for a while I had the idea of creating a kind of icon project that can be included in any web application just like an ordinary dependeny. This project only contains a project descriptor (pom.xml) which declares it as a project of type war. Further it includes the tango icons in the folder images/tango plus a WEB-INF/web.xml (without any specific configuration, pretty much empty). Any project that requires tango dektop icons just declares a maven dependency to this icon project. Any time this project is packaged (as a war file) Maven automatically unpacks the icon project into the packaged project and thus makes sure that it is up to date.

1
2
3
4
5
6
7
<dependency>
         <groupId>com.example.projects</groupId>
         <artifactId>tango-desktop-icons</artifactId>
         <version>1.0-SNAPSHOT</version>
         <type>war</type>
         <scope>runtime</scope>
</dependency>

For working within an IDE it is sufficient to perform the Maven command war:inplace to unpack the icon project into the project workspace!

This is called WAR overlaying!

Comments