Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Dashboard
Maven User
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<table class="wysiwyg-macro" data-macro-name="info" data-macro-parameters="title=Why does this page exist?" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2luZm86dGl0bGU9V2h5IGRvZXMgdGhpcyBwYWdlIGV4aXN0P30&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="RICH_TEXT"><tr><td class="wysiwyg-macro-body"><p>Having run into the "skinny wars" issue, I've found there's a lot of info about this, but it's very fragmented. This page is an attempt at centralizing all that information to eventually work out a lasting solution to this problem. Please chime in with whatever you have to add. Thanks! --<a class="confluence-link confluence-userlink" data-username="barend" href="/display/~barend" data-linked-resource-id="77332939" data-linked-resource-type="userinfo" username="barend" data-linked-resource-default-alias="Barend Garvelink" data-base-url="http://docs.codehaus.org">Barend Garvelink</a></p></td></tr></table> <img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e3RvY30&locale=en_GB&version=2" data-macro-name="toc"> <h2>Summary</h2> <p>There are a lot of issues in the Maven 2.x JIRA about EAR files containing "skinny" WAR files and the manifest class path. Some of these have been resolved, many are unresolved. Some of the solutions currently in place are work-arounds rather than real solutions. The key points:</p> <ol> <li>By default, all dependencies of a WAR module are contained in the WEB-INF/lib folder of a WAR file.</li> <li>The J2EE spec allows a WAR file (or in fact any other module) contained within an EAR to refer to other modules in that EAR file by mentioning them in the manifest Class-Path. These modules can then be removed from the WEB-INF/lib folder, creating what's informally known as a "skinny" WAR file. This can avoid duplication of library modules.</li> <li>The current procedure for creating a skinny WAR is explained in <sub>[SKIN]</sub>. The main problem with this approach is that it requires duplication of dependency data from the WAR project's file into the EAR project's pom. There are more subtle problems too, explained in the next section.</li> </ol> <p>Notes:</p> <ul> <li>wrt. #1: This is the correct behaviour for stand-alone WAR modules and should remain the default.</li> <li>wrt. #2: In fact, the J2EE specification <em>requires</em> that duplication is eliminated in this way, as mentioned in <sub>[MC06]</sub>.</li> </ul> <h2>Problems with the current approach</h2> <p>Here's an overview of the JIRA issues touching on this subject. If you spot any omissions, please add them to the table.</p> <table class="confluenceTable"><tbody> <tr> <th class="confluenceTh"><p> Key </p></th> <th class="confluenceTh"><p> Title </p></th> <th class="confluenceTh"><p> Status </p></th> </tr> <tr> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MWAR-9">MWAR-9</a> </p></td> <td class="confluenceTd"><p> WAR plugin should support minimal WARs for inclusion within an EAR </p></td> <td class="confluenceTd"><p> Open </p></td> </tr> <tr> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MWAR-21">MWAR-21</a> </p></td> <td class="confluenceTd"><p> Need a way to include limited set of webapp's dependencies </p></td> <td class="confluenceTd"><p> Closed fixed (with commenters protesting) </p></td> </tr> <tr> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MWAR-61">MWAR-61</a> </p></td> <td class="confluenceTd"><p> Document how to set manifest classpath and exclude dependency from WEB-INF/lib </p></td> <td class="confluenceTd"><p> Closed fixed </p></td> </tr> <tr> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MWAR-81">MWAR-81</a> </p></td> <td class="confluenceTd"><p> Request enhancement to pattern matching for warSourceIncludes/warSourceExcludes functionality (regular expressions?) </p></td> <td class="confluenceTd"><p> Open </p></td> </tr> <tr> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MWAR-111">MWAR-111</a> </p></td> <td class="confluenceTd"><p> Transitive dependencies of optional dependencies are included in WEB-INF/lib </p></td> <td class="confluenceTd"><p> Open </p></td> </tr> <tr> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MWAR-135">MWAR-135</a> </p></td> <td class="confluenceTd"><p> Add an option to exclude content from the generated archive to implement the skinny war process </p></td> <td class="confluenceTd"><p> Closed fixed </p></td> </tr> <tr> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MWAR-146">MWAR-146</a> </p></td> <td class="confluenceTd"><p> Better support for skinny wars </p></td> <td class="confluenceTd"><p> Closed won't fix </p></td> </tr> <tr> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MNG-1991">MNG-1991</a> </p></td> <td class="confluenceTd"><p> Can't get transitive dependencies from a war pom when this war is added as a depdency of a project </p></td> <td class="confluenceTd"><p> Open </p></td> </tr> <tr> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MNG-2205">MNG-2205</a> </p></td> <td class="confluenceTd"><p> "provided" scope dependencies must be transitive </p></td> <td class="confluenceTd"><p> Open<br class="atl-forced-newline" /> </p></td> </tr> <tr> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MNG-3269">MNG-3269</a> </p></td> <td class="confluenceTd"><p> Different builds for ejb-client optional with parent </p></td> <td class="confluenceTd"><p> Open </p></td> </tr> <tr> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MEAR-17">MEAR-17</a> </p></td> <td class="confluenceTd"><p> Jar files packed in the EAR file should also be added to application.xml or manifest.mf </p></td> <td class="confluenceTd"><p> Closed won't fix </p></td> </tr> <tr> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MEAR-60">MEAR-60</a> </p></td> <td class="confluenceTd"><p> Improve support for skinny WAR files </p></td> <td class="confluenceTd"><p> Open </p></td> </tr> <tr> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MEAR-75">MEAR-75</a> </p></td> <td class="confluenceTd"><p> Incorrect file name in class path (in manifest) if specifying different bundleFileName for module </p></td> <td class="confluenceTd"><p> Closed, fixed </p></td> </tr> </tbody></table> <p>MNG-3269 is particularly insidious.</p> <p>The <code>warSourceExcludes</code> parameter used in <sub>[SKIN]</sub> feels like a hack to me. The maven-war-plugin figures out what to include like it always does, puts it neatly into a working directory under <code>target/</code>, then when it zips up the final artifact the files listed magically disappear. This 'hackishness' is reflected in the fact that the <code>warSourceExcludes</code> argument affects the standard <code>war:war</code> goal, but is ignored in <code>war:exploded</code> and <code>war:inplace</code>. In my opinion, this parameter should be deprecated and disposed of as soon as a better solution is in place.</p> <p>While <sub>[SKIN]</sub> gives you reasonable control over where the libraries end up (albeit awkwardly because of the duplication of the <code><dependency></code> elements), the amount of control you have over the manifest class-path is too little. You can configure the entire thing by hand, which is awkward in its own right, or you can influence it with the <code>provided</code> scope (subject to MNG-3269), but that's not really powerful. For example, if you want to use the <code><bundleFileName></code> and/or <code><defaultLibBundleDir></code> configuration elements of the maven-ear-plugin, you cannot automatically provide a correct manifest class-path.</p> <h2>Patches currently in JIRA</h2> <p>The following issues include patches: MWAR-9, MWAR-21, MWAR-61, MWAR-111, MWAR-146, MWAR-3269.</p> <p>Note that all of these address the maven-war-plugin.</p> <h2>Whose problem is this, anyway?</h2> <p>This issue is reported against both the maven-war-plugin and the maven-ear-plugin. Most of the patches seem to be for the maven-war-plugin. However, in my opinion "skinny" is an issue that should be addressed in the maven-ear-plugin, not in the maven-war-plugin.</p> <p>My arguments for this are:</p> <ol> <li>A war file is valid as a stand-alone deployment unit. This issue specifically affects war files (and any other modules) that are embedded into an ear file. A war project build need not (and arguably <em>should</em> not) be aware of whether its artifact is ultimately deployed as a fat stand-alone module or as a skinny ear component.</li> <li>An EAR file can contain internal directory structure (a <code>lib</code> folder is not uncommon) that must be reflected in the manifest class-path of the embedded modules.</li> <li>The Manifest class-path is a concern not just for WAR modules, but for other module types embedded into an EAR as well.</li> <li>Any module can become part of more than one EAR file.</li> <li>Any module that gets embedded into an EAR file ceases to exist as a stand-alone artifact in that scope, justifying the ear plugin's mucking about in a module's contents.</li> </ol> <p>Note that the common way of addressing #1 and #2 (in the build spec of the embeddable artifact) surreptiously creates a circular dependency problem.</p> <h2>Requirements for a lasting solution</h2> <p>As mentioned before, I think this issue should be addressed in maven-ear-plugin, not in maven-war-plugin.</p> <table class="confluenceTable"><tbody> <tr> <th class="confluenceTh"><p> # </p></th> <th class="confluenceTh"><p> Summary </p></th> </tr> <tr> <td class="confluenceTd"><p> 1 </p></td> <td class="confluenceTd"><p> The maven-ear-plugin must (be able to) (re)write the manifest class path of any module embedded into its artifact ear file. </p></td> </tr> <tr> <td class="confluenceTd"><p> 2 </p></td> <td class="confluenceTd"><p> When (re)writing a manifest class path, the effect of any <code><bundleFileName></code> configuration must be taken into account. </p></td> </tr> <tr> <td class="confluenceTd"><p> 3 </p></td> <td class="confluenceTd"><p> When (re)writing a manifest class path, the effect of any <code><defaultLibBundleDir></code> configuration must be taken into account. </p></td> </tr> <tr> <td class="confluenceTd"><p> 4 </p></td> <td class="confluenceTd"><p> The maven-ear-plugin must be able to (selectively) prune the WEB-INF/lib folder any WAR artifacts it embeds. </p></td> </tr> <tr> <td class="confluenceTd"><p> 5 </p></td> <td class="confluenceTd"><p> When (re)writing a manifest class path, take conflict resolution into account (<a class="confluence-link confluence-userlink" data-username="mschutte" href="/display/~mschutte" data-linked-resource-id="49625" data-linked-resource-type="userinfo" username="mschutte" data-linked-resource-default-alias="Marcel Schutte" data-base-url="http://docs.codehaus.org">Marcel Schutte</a>) </p></td> </tr> <tr> <td class="confluenceTd"><p> 6 </p></td> <td class="confluenceTd"><p> Must be able to specify in the ear pom which libraries are affected by #1 and #4 (<a class="confluence-link confluence-userlink" data-username="bryanl@islandbeast.com" href="/display/~bryanl@islandbeast.com" data-linked-resource-id="77692990" data-linked-resource-type="userinfo" username="bryanl@islandbeast.com" data-linked-resource-default-alias="Bryan Loofbourrow" data-base-url="http://docs.codehaus.org">Bryan Loofbourrow</a>) </p></td> </tr> <tr> <td class="confluenceTd"><p> </p></td> <td class="confluenceTd"><p> <em>please contribute</em> </p></td> </tr> </tbody></table> <h2>References</h2> <table class="confluenceTable"><tbody> <tr> <th class="confluenceTh"><p> id </p></th> <th class="confluenceTh"><p> href </p></th> </tr> <tr> <td class="confluenceTd"><p> SKIN </p></td> <td class="confluenceTd"><p> <a href="http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html">Creating skinny wars</a> </p></td> </tr> <tr> <td class="confluenceTd"><p> MC06 </p></td> <td class="confluenceTd"><p> <a href="http://jira.codehaus.org/browse/MWAR-21?focusedCommentId=61976#action_61976">Comment by Mark Chesney in MWAR-21 on 2006-03-26</a> </p></td> </tr> </tbody></table>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced