I have been struggling with the Skinny War issue. The problem is that you
have to manually track your libraries in each war, then go through your ear
to get the libraries working. This is the anti-thesis of what Maven is
suppose to be doing.

I understand the complexities of the issue. When a project builds the wars,
it doesn't know what libraries each war will be dependent upon. When the ear
is built, it is too late for the ear to try to calculate what are the
duplicate jars.

However, I believe I found a possible solution to this issue. The solution
would be to create ultra-skinny wars which contain no jar files at all.
Instead, all jar files will be stored in the ear. It's not exactly the
solution we are looking for, but it does work.

What we would need is the directory location where the wars will store their
jar files and where the ear will pick up these jarfiles. Duplicates are
handled by the fact that since all the jars are in a single directory, if a
war downloads a jar that another war has already downloaded, the second war
will simply replace that jarfile with a duplicate jarfile. This could be
done with a property in the project's root pom.xml.

When a war is built, and this property is set, the war will download its
dependencies to this directory instead of putting them into the WEB-INF/lib
directory. When the ear is built, and this property is set, the ear project
will include the downloaded jars in this directory when the ear is built.

There will have to be changes in the maven-ear-plugin and the
maven-war-plugin to recognize this property. Plus, there may have to be
further configurations for stating whether this war is suppose to be skinny
or not, the changes in the classpath in the MANIFEST.MF file, etc. However,
I believe these would be relatively minor.

In the end, you eliminate the duplicate jars without having to go through
all sorts of manipulation in the dependencies settings of your wars and ear.

Do you think this will work?

-- 
David Weintraub
qazw...@gmail.com

Reply via email to