Hi Geoffry
Geoffrey De Smet wrote:
> Hi guys,
>
> If I look at the maven dependency tree of XStream, I get this (same for
> 1.4.9):
>
> [INFO] +- com.thoughtworks.xstream:xstream:jar:1.4.7:compile
> [INFO] | +- xmlpull:xmlpull:jar:1.1.3.1:compile
> [INFO] | \- xpp3:xpp3_min:jar:1.1.4c:compile
>
> xstream is high quality, active, well maintained jar with a maven build,
> sources in Git.
> xmlpull is a inactive project with a ANT build (or worse), sources in CVS.
> xmlpull contains just 4 classes.
That's the official implementation.
> xmlpull is a PITA.
> The lack of a maven or gradle build makes it hard to build from source
> for RPM's.
It does not have to change, it just runs.
BTW: Ever tried to find the source repository for Xpp3?
> The lack of manifest metadata makes it a risk (= an exception) for OSGi,
> JBoss modules, Java 9 (Jigsaw), ...
> For example, in Java 9 it will never be in the module path in it's
> current state.
We'll see, what we have to do about it with Jigsaw.
> I would like to propose 3 ways to improve the situation (to Jorg and the
> community):
>
> Proposal A) Replace the xmlpull and xpp3_min dependency with the xpp3
> dependency.
> The xpp3 dependency embeds the 4 xmlpull classes.
No. Xpp3 is one possible implementation, kXML2 is the other one and a
derived one is e.g. default on Android. One reason for selecting xpp3_min as
default is exactly because the XmlPullParser API is *not* embedded. XStream
already tried to switch to kXML2 years ago and failed badly:
http://x-stream.github.io/jira/659/
In XStream 1.3.x Xpp3 was the only supported XmlPullParser, this was
explicitly changed for XStream 1.4.
> Proposal B) Embed the 4 xmlpull and the 3 xpp3_min classes in xstream.
> To avoid split packages (OSGi req), they should probably be
> subnamespaced into
> package com.thoughtworks.xstream.org.xmlpull...
Never. It is on purpose that XStream uses the factory of the XPP API. It is
the official method to select between the different XPP implementations.
Embedding the API under a different package does not make sense. In Android
you simply exclude both dependencies and use nevertheless the XPP factory.
> Proposal C) Revive xmlpull: migrate it to github and mavenize it.
I don't think you will ever get something into Maven central using
xmlpull:xmlpull. And using a different G:A will make the situation worse,
because you'll add another library containing classes with the same name.
> Legal implications (I am not a lawyer, this is not legal advice)
> "The XmlPull API is in public domain in hope that it will be embraced by
> Java developers (conformance tests are under LGPL license to minimize
> risk of incompatible implementations)."
> So embedding the non-test classes is ok (just keep the original legal
> header),
> it will not affect xstream's license.
> But we can't copy the tests as that would impact the xstream license -
> unless we get the original authors to agree on re-license the tests
> under a BSD license.
>
> What do you think?
If you don't like the XStream default, why don't you simply exclude the two
dependencies and add the one you like to use (e.g. xpp3)? Or, if you only
don't like the XPP API, then simply use directly the Xpp3Driver and exclude
xmlpull.
Cheers,
Jörg