users@jaxb.java.net

Re: Re: Re: how to avoid duplicated (generated) classes?

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Wed, 17 Dec 2008 11:38:40 +0100

Hi.
> ==> This works fine - all generated sources are placed to
> \target\generated-sources\java\de\gematik\ws\schema\personalisierung - as
> expected from the namespace.
>
> I want to change that location, so I tried:
>
> <xjc
> destdir="${project.basedir}/${target.dir}/generated-sources/java"
> removeOldOutput="yes" package="com.mycompany.test">
> ...
> and I got:
> [xjc] [ERROR] A class/interface with the same name
> "com.mycompany.test.KeyValueType" is already in use. Use a class
> customization to resolve this conflict.

Specifying package is not the best idea when you're working with many
schemas/namespaces.

> So I tried to define the package via separate bindings files, defining the
> same package:
>
> <xjc
> destdir="${project.basedir}/${target.dir}/generated-sources/java"
> removeOldOutput="yes">
> <binding dir="src/main/resources/schemas">
> <include name="bindings.xjb"/>
> <include name="vsd51/bindings.xjb"/>
> <include name="ed4gm51/binding_a.xjb"/>
> <include name="ed4gm51/binding_b.xjb"/>
> </binding>
>
> binding_a.xjb:
> <jxb:bindings schemaLocation="a.xsd" node="/xs:schema">
> <jxb:schemaBindings>
> <jxb:package name="com.mycompany.test"/>
> </jxb:schemaBindings>
> </jxb:bindings>
>
> binding_b.xjb
> <jxb:bindings schemaLocation="b.xsd" node="/xs:schema">
> <jxb:schemaBindings>
> <jxb:package name="com.mycompany.test"/>
> </jxb:schemaBindings>
> </jxb:bindings>
>
> and I got:
> [xjc] [ERROR] Multiple <schemaBindings> are defined for the target
> namespace "http://ws.gematik.de/schema/Personalisierung/ed414/v5.2"
> [xjc] line 12 of
> file:...../src/main/resources/schemas/ed4gm51/binding_b.xjb
> [xjc]
> [xjc] [ERROR] Another <schemaBindings> is defined here

Try specifying schemaBindings just once. All of your schemas are in
the same namespace, if you define schemabindings just for one of the
it will be enough.

Bye.
/lexi