users@jaxb.java.net

Re: ClasspathCatalogResolver - including dependency jars

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Sun, 14 Aug 2011 16:23:27 +0200

Hi,

Sorry for the delay, I'm on vacations at the moment.

> A colleague and myself have been struggling with getting the
> ClasspathCatalogResolver to work with our catalog etc. to pick up schemas
> from a dependent project jar.

Check this feature:

http://confluence.highsource.org/display/MJIIP/User+Guide#UserGuide-Resourceentries

> The problem I had noticed was that the
> dependent jar wasn't available to the ClasspathCatalogResolver when invoked
> from the maven-jaxb2-plugin.  We eventually got it to work, by adding
> <plugins> into our <configuration>, as per your
> maven-jaxb2-plugin-sample-episode-maven sample, but it took us a while to
> figure that out.

Yes, dependency resolution is a bit tricky in maven.

> During my investigation I stumbled upon a mojo setting called
> "requiresDependencyResolution" and wondered whether it may be
> useful/beneficial to include that in the plugin.xml?  It sounds like that
> can be used to make the dependency jars automatically available to the
> plugin.  (I've never written a maven plugin though, so may be completely
> wrong.)
>
> Anyway this is just an idea/suggestion.

Thank you, Chris. Unfortunatelly, it won't help.
ClasspathCatalogResolver works with the XJC classpath which is
different from the classpath of maven-jaxb2-plugin, so any adjustments
for the classpath of maven-jaxb2-plugin won't have any effect.
Anyway, I think that ClasspathCatalogResolver is not the best way to
resolve schemas across JARs. I have implemented it quite a while ago
as a quick hack, but it is not the right solution.
In 0.8.0 I've implemented a possibility to include a dependency
resource into compilation:

http://confluence.highsource.org/display/MJIIP/User+Guide#UserGuide-Resourceentries

There's no catalog support for dependency resources yet (see
http://java.net/jira/browse/MAVEN_JAXB2_PLUGIN-44), but generally this
will be the direction of the solution.

Bye,
/lexi