Hi!

This topic was just discussed yesterday:
http://maven.40175.n5.nabble.com/Are-skinny-WARs-still-recommended-td5786626.html

On 28 Feb 2014, poroto20 wrote:

> I have one EAR project and I am trying to have a skinny war. It seems to be
> working ok but for some reason it keeps copying 3 dependencies into war/lib
> folder, which are commons-logging-1.0.4.jar, commons-codec-1.4.jar and
> jboss-seam-2.2.1.Final.jar.

The only dependencies to these artifacts seem to come from the WAR. So
the m-ear-p needs not to extract them to the EAR.

> I the EAR's pom I added `<skinnyWars>true</skinnyWars>`.

That's correct!

> I made sure I added
> exclusions for those three jars, or they are `scope=provided`. I also added
> `<packagingExcludes>**/*.jar</packagingExcludes>` in the WAR's pom file.

You don't need to do anything in the WAR. The m-ear-p repackages the WAR,
so it's entirely the responsibility of the m-ear-p.

> I really can't understand maven's logic to create the war (or to copy those
> jars).

The m-ear-p tries to extract all JARs that are also referenced from
outside the WAR to the EARs lib folder, so they can be reused by other
modules in the EAR.

Artifacts that are only used by the WAR should remain in the WAR.

Artifacts that are JSF libraries (like RichFaces, OmniFaces, etc.) should
also stay in the WAR because otherwise JSF won't scan them for
initialization. See the link above for more details.

> 1) When I run maven only for the WAR project, the WAR has no jars in /lib
> folder

Yes, but that's something completely different! The WAR will get
re-packages by the m-ear-p if you configure skinnyWars for the m-ear-p.

> 2) But when I run maven for all the projects (including the EAR) it copies
> those 3 jars in the war file.
> 
> What am I doing wrong? Why is different the WAR created with maven inside
> the WAR project then for all projects (including EAR)? Please help

hth,
- martin

Attachment: signature.asc
Description: PGP signature

Reply via email to