users@jaxb.java.net

Re: maven-jaxb2-plugin configuration issue

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Wed, 25 May 2011 10:02:16 +0200

Hi,


On Tue, May 24, 2011 at 3:23 PM, Michal Moravcik
<miso.moravcik_at_gmail.com> wrote:
> Hi Aleksei
> I'm currently configuring your maven-jaxb2-plugin and I have following
> scenario:
> A/src/main/resources/a.xsd
> A/src/main/resources/b.xsd (includes a internally)
> A/src/main/resources/c.xsd (includes a internally)
> A/pom.xml - nothing, just build .jar with xsd files
> B/pom.xml - depends on A and I want to instruct maven-jaxb2-plugin here to
> generate classes from b.xsd
> The reason for this approach is because I have separated module for xsd
> schemas and the code will be generated in other modules as needed with
> specific bindings, which can vary from module to module (e.g. adding GWT
> interface IsSerializable to generated code)
> I have studied your episode and catalog examples, but I still don't know if
> it is possible to instruct maven-jaxb2-plugin to generate classes for a xsd
> file located in dependent maven module (A). Technically, in this case the
> <schemaDirectory> should be pointing to classpath: or
> <schemaIncludes><include> should point to xsd from A module, something like
> classpath:b.xsd

This might be possible with catalog files, but I don't have an example
at the moment. Point schemaInclude to a virtual schema and use catalog
to map this virtual schema to a classpath location. A.jar must be in
classpath (Maven dependency).

> After my tryouts I got an error message like B/classpath: directory doesnt
> exist, or just warning: Skipped XJC execution. Nothing to compile.
> Could you please give me a hint if the mentioned approach is possible to
> configure and possibly how.
> Thank you in advance and looking forward for hearing from you.

BTW here's an issue to allow resolving schemas inside Maven artifacts.

http://java.net/jira/browse/MAVEN_JAXB2_PLUGIN-35

Alternative would be to use Maven dependency plugin to extract schema
from A into B during build.

Please consider using the public ML users_at_jaxb.java.net so that
everyone could profit from answers.

Bye.
/lexi