Issue Details (XML | Word | Printable)

Key: MEAR-60
Type: Improvement Improvement
Status: Open Open
Priority: Critical Critical
Assignee: Unassigned
Reporter: Marcel Schutte
Votes: 42
Watchers: 33
Operations

If you were logged in you would be able to see more operations.
Maven 2.x Ear Plugin

Improve support for skinny war files

Created: 29/Mar/07 02:49 PM   Updated: 15/May/08 07:48 AM
Component/s: None
Affects Version/s: 2.3
Fix Version/s: None

Time Tracking:
Not Specified

Environment: mvn 2.0.5
Issue Links:
Related


 Description  « Hide

Provide a boolean configuration option for webModules to include the war's transitive dependencies.

As described on http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html it is very common in a J2EE environment to use so called skinny wars. Here the war's WEB-INF/lib will not contain the dependent jars, but instead they are packaged inside the EAR. The war references them through its META-INF/MANIFEST.MF

This option could be used to avoid the 'painful part' mentioned in the above web page. The war's dependencies wouldn't have to be duplicated alongside the ear's.

I also found an old issue (MEAR-14) which has asked for the current default behavior of not including the transitive dependencies. It suggests a property to include specific dependencies of the war. As far as I can tell this has never been implemented and this is also not what I am asking for. My proposal is an all of nothing kind of option for each war module in the ear.

On a side note, for me this is the part where removal of the old maven 1 style properties per dependency is missed the most. With them it was possible to decide for each single dependency whether to put it in WEB-INF/lib or reference it through the manifest classpath. But of course, then we didn't have the transitive dependencies



Heinrich Nirschl added a comment - 18/Apr/07 11:47 AM

I don't think that a boolean configuration option is flexible enough. There are situations where you want most of your jars in the ear, but still some of them in the war (for example, if they contain a tag library - the jsp compiler does not find the tag library if it is in the ear).


Marcel Schutte added a comment - 20/Apr/07 01:29 AM

I agree that extra flexibility is needed. It is just that as far as I understand maven, such a change would have a major impact on mavens dependency handling. I don't think that is going to happen soon and therefore I am trying what for me is 'the next best thing'.


Stephane Nicoll added a comment - 04/Jun/07 02:21 PM

There's nothing I can do at this point. We need an update on how war dependencies are handled.


Brian Topping added a comment - 30/Aug/07 09:33 PM

A new build I am working on needs the jars available to non-web resources, so a skinny war is needed. Ouch.

It seems like state should be able to be stored in the WAR manifest that a skinny WAR is desired, and the EAR plugin looks at the manifest to see if it has that flag. If so, the POM in the WAR is parsed and the dependencies (with transitives) is included.

Truly, the 'painful part' of this isn't getting the direct dependencies of the WAR into the ear, it's all the transitives. Suddenly, one of the best things about m2 is broken.

I would code this up, but I haven't had much luck getting patches applied before they go stale, resulting in a lot of wasted effort. If someone made a commitment to apply this, I would code it with the test cases.


Barend Garvelink added a comment - 02/Apr/08 06:01 AM

Created a link between this issue and MEAR-75 (module manifest Class-Paths) because some application servers (e.g. WAS 5.1) require a correct manifest Class-Path in a skinny WAR to make it work.


Barend Garvelink added a comment - 04/Apr/08 08:46 AM

This is a big issue for a lot of people, and the information on it appears to be very fragmented. I have tried to summarize all the information related to this issue on the Codehaus wiki so that a good, lasting solution can hopefully be found. Please chip in with your thoughts:

http://docs.codehaus.org/display/MAVENUSER/Solving+the+Skinny+Wars+problem