Monday, March 23, 2009

Finally! Practical Maven Skinny Wars

So, Maven 2.1 was finally released. I can't say I'm overly impressed with the pace, but considering it was driven almost exclusively by John Casey, it's a great achievement, nonetheless. Deterministic Build Lifecycle Planning (or DeBLiP, as we [well, just me] in the industry call it) is such a huge leap forward in build repeatability, it's hard to comment on at this stage. It's something best held to the clearer lens of retrospect.

But enough about that. Something of immediate practical value: real skinny WARs. Until now the maven-war-plugin left you with two choices: no jars, or most jars. Sure, you could manually exclude all but a set, but it was a PITA and unpractical. Behold my surprise to find the newest WAR config addition to 2.1-beta-1: packagingIncludes.

Use case:
I want a mostly skinny WAR that filters out all JARs except for struts.

Thanks WAR plugin guys! Now just fix the EAR problem and I'll be set.


Dave White said...

I'm one of the many also facing this problem, and I was very excited to try packagingIncludes. GOOD NEWS:, it looks like it worked to include my jar. BAD NEWS: the war had almost no other contents, it looks like the plugin is serioulsy broken (or I am missing something fundamental I need to change), but my pom works fine in the alpha realease...

Jim Cook said...

It appears that <packagingIncludes> and <packagingExcludes> cannot be used together which is very unfortunate. If you want to use &ltpackagingIncludes>, it appears you have to list a set of wildcard parameters for every file that you need in your war, icluding jsp's, images, style sheets, tag files, etc... What a pain.