Sachin Mittal wrote:
Hi,
I have frequently encountered this problem that versions of third party jars
across modules are not uniform.
Like the xwiki-core uses commons-lang of version 2.1 and lucene 2.3.
Similarly some module uses xerces-impl of version 2.0.2 where as some other
2.8.1.
As the xwiki build can be made of different modules as per custom
requirements, when we bring these modules together there is a conflict in
the jar versions.
This way different jars of same version end up in the lib directory and
causes class not found exceptions.
I don't know what is the best way to avoid such a problem, but best I can
think is when building the pom we should ensure that version of the third
party jar stays uniform atleast across xwiki-platform.
That should happen, but I think this is a maven bug: when declaring a
dependency if type "war", the sub-dependencies are not considered, as it
is assumed that they are already bundled.
1. When building the platform-web, platform-core along with a bunch of
dependencies are placed inside the resulting war.
2. When building product-enterprise-web, for example, the platform-web
war is expanded, and the plugins along with their dependencies are
added. Now, some plugins use different versions of the dependencies than
the core, but since Maven discarded the platform-web -> platform-core
dependencies, it doesn't know that different versions are in there
already, so it adds the new dependencies required by the plugins,
without removing the old ones from the platform-web expanded war.
We should fix the different dependency versions (which I already did for
Lucene, as it is not really needed in the core, just in the
lucene-plugin). I also noticed the two commons-lang that show up in the
XE libs, and was planning to investigate it later.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/