>>I don't think it's possible to do this automatically - that would require the war project to be aware that it was going to be included in the ear project. There is a way to do manually. See http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.ht ml (or using the provided scope as you mention).<<
This is a longstanding issue in Maven. Barend Garvelink made a page about it here: http://docs.codehaus.org/display/MAVENUSER/Solving+the+Skinny+Wars+probl em While I would prefer a more automatic solution from Maven (this is discussed extensively on the page), I do think my preferred approach is better than what's described on the official skinny wars page, especially the portion that begins "Now the painful part." To quote my comment at the bottom of Barend Garvelink's page: (open self-quote)Here's what I do currently. For me, a skinny war is two projects. The war project itself, and a pom project that contains all of the dependencies. In the war project, I use warSourceIncludes (note that this is broken in the alpha-2 plugin: MWAR-182) to specify the (generally quite small) set of jars that must be packaged in the war, along with an extensive list of extensions for non-jars. I make the war project dependent on the dependency project. Then, in the ear, I add dependencies on both the war and the dependency project.(close self-quote) Better than duplicating all of the dependencies, I think. -- Bryan -----Original Message----- From: Edelson, Justin [mailto:[email protected]] Sent: Wednesday, September 16, 2009 3:54 PM To: Maven Users List Subject: RE: War packaged in ear. How to exclude shared jars I don't think it's possible to do this automatically - that would require the war project to be aware that it was going to be included in the ear project. There is a way to do manually. See http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.ht ml (or using the provided scope as you mention). Justin ________________________________ From: David Weintraub [mailto:[email protected]] Sent: Wed 9/16/2009 6:17 PM To: Maven Users List Subject: War packaged in ear. How to exclude shared jars We have multiple modules in this configuration: <root> aim core web* war* aimwebservices* projects ear** adinventory base jar hibernate-har ui *Builds a warfile and not a jar ** Builds the earfile that contains everything. Our module aim/web is dependent upon aim/core and that is dependent upon springframework:core. When we build, the aim.war file gets a copy of the springframework:core jarfile. However, this file is also in the "ear" project where an ear that contains all the jars and wars are packaged. Our developers don't want the aim:web warfile to contain the springframework:core jarfile since it is already in the overall earfile. We know we can specifically mention the dependency on springframework:core, then give its type as provided, but I am looking at an overall strategy: If a warfile will contain a jarfile that is already in the ear, we don't want it packaged in our warfile. Is that possible? -- David Weintraub [email protected] This message and the information contained herein is proprietary and confidential and subject to the Amdocs policy statement, you may review at http://www.amdocs.com/email_disclaimer.asp --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
