Inheriting/Extending a Web Application

by Tim O'Brien

A Maven 2 JIRA issue that caught my attention today. Extending a Web application has always been something I've been interested in doing, and it looks like David Hawkins submitted this feature to the Maven 2.x WAR plugin back in November, and I'm just now noticing.

I haven't used this feature yet, but it is definitely something to take note of. Let's say you have 10-20 web applications all of which reuse the same set of tag files, the same set of CSS, same icons, etc. You might customize a few JSP pages and add some custom classes. It makes sense to consolidate common elements into a generic "default" web application and then work some logic into your build that allows you to selectively override these defaults. The interesting part is that this plugin allows you to "copy the contents of dependent wars into the war being built. It will never overwrite existing files and has configurable includes and excludes which are applied to the files being copied". So, you could conceivably create a number of mixins that your web application could inherit.

It could get messy if misused, but this seems like another step toward making web applications a bit easier. Anyone out there successfully using this feature?


Bill Siggelkow
2006-04-12 12:45:38
I haven't used this feature (I've just started dipping my nose into the Maven cauldron) but this sounds like a feature that would apply to assemblies in general. In other words, you could build the parent assembly and then copy / merge dependent assemblies.
Bertil Karlsson
2006-04-12 13:39:49
We are using this feature in one of our projects, however we only use it for property file handling at the moment. I believe more will come though. So far so good, no worries
Fredrik H
2006-05-10 07:53:52
Yes, we do. Unfortunatly it's not the official 'war' packaging. Right now I'm trying to use it with the official 'war' and it's not working. So I'm wondering if it's in a release yet, or my local repo is out of date.