[Yanel-dev] Multiple xml-apis libs version

Guillaume Déflache guillaume.deflache at wyona.com
Thu Sep 3 14:29:44 CEST 2009


Hi!

Michael Wechner schrieb:
> Hi
> 
> I just noticed that there are multiple xml-apis libs within WEB-INF/lib.
> 
> I will try to exclude the older versions by adding them the ambiguous 
> lib list within src/build/build.properties
> 
> Cheers
> 
> Michi

In 
http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html 
see the section "Dependency Exclusions" for how to maybe solve this 
better (what 
http://bugzilla.wyona.com/cgi-bin/bugzilla/show_bug.cgi?id=7006 is 
already about).

It says:
 > Projects that you depend on may not have declared their set of 
dependencies correctly, for example.

In our case, this may happen for example:

1) when there are multiple groupId/artifactId couples for the same 
library (e.g. commons-collections/commons-collections and 
apache-jakarta-commons/apache-jakarta-commons-collections) then:
- Maven cannot probably tell they are really the same library (Apache 
Commons Collections),
- and then cannot only keep the latest version in the classpath as it 
normally should:
- we end up with several JARs for the same library in WEB-INF/lib (e.g. 
apache-jakarta-commons-collections-3.2.jar and commons-collections-3.2.jar),
- and maybe sometimes even with the same name except for the version, 
because only the groupId is different

2) there are other cases but it is not yet clear to me what happens :( 
so I will not try to elaborate on that for now!


To debug that I found that adding verbose="true" on 
<artifact:dependencies/> in dependencies.xml files help (is it the 
equivalent of the '-X' command-line option? maybe that one is better but 
we cannot use it as we only use Maven through Ant), but:
- sadly we would have to add that on all such elements in every single 
resource-type to diagnose things fully
- one should also not commit the change as it makes builds extremely verbose

So maybe what we could do is:
- replace all "artifact:dependencies" with an Ant macro with which we 
could activate debugging globally; this could also help refactor the 
dependencies files, for example automatically adding <remoteRepository 
refid="wyona.remote.repository"/> inside the elements and *maybe* adding 
defaults for "pathId" and "filesetId" attribute values would be nice
- try to fix things with exclusions starting with as few 
dependencies.xml files as possible, starting for example from the 
"yanel-minimal" project from the contributions: 
http://svn.wyona.com/repos/public/yanel/contributions/projects/yanel-minimal/

WDYT?


Cheers,
    Guillaume


More information about the Yanel-development mailing list