users@jaxb.java.net

Re: Generating schema for class files in a jar

From: Nick Stolwijk <nick.stolwijk_at_gmail.com>
Date: Mon, 28 Sep 2009 18:08:36 +0200

That is strange. In the output from the plugin I see that the jarfile
of Task-commons is on the classpath for the schemagen program. The
java files are not. It still generates the following in the default
namespace:

  <xs:complexType name="person">
    <xs:complexContent>
        <xs:sequence>
          <xs:element name="name" type="xs:string" minOccurs="0"/>
        </xs:sequence>
    </xs:complexContent>
  </xs:complexType>

So it must be processing the class files.

Nick Stolwijk
~Java Developer~

IPROFS BV.
Claus Sluterweg 125
2012 WS Haarlem
http://www.iprofs.nl



On Mon, Sep 28, 2009 at 6:04 PM, Wolfgang Laun <wolfgang.laun_at_gmail.com> wrote:
> The schemagen program processes source files only.
> -W
>
> On Mon, Sep 28, 2009 at 5:50 PM, Nick Stolwijk <nick.stolwijk_at_gmail.com>
> wrote:
>>
>> Hi,
>>
>> I am using the Maven JAXB Schemagen plugin to generate a schema for my
>> java files. However, a few class files are in one of the dependencies
>> of my module. This dependency contains a package-info.class with the
>> @XmlSchema annotation. This file seems not to be read, because the
>> schema is generated in the default namespace. Is it possible to use
>> the XmlSchema annotation from the jar to generate the schema?
>>
>> My project layout:
>>
>> -Task-Commons
>>     -src/main/java
>>             -com/example.model
>>                   -Person.java
>>                   -package-info.java
>>     pom.xml
>> -Task-Module
>>    -src/main/java
>>              -com/example/module/model
>>                    -Task.java
>>                    -package-info.java
>>    pom.xml
>>
>> The schemagen plugin has been defined in the Task-Module pom.xml.
>>
>> The Task-Module depends on the Task-Commons module.
>>
>> The package-info in the Task-Module contains an XmlSchema annotation:
>>
>> @javax.xml.bind.annotation.XmlSchema(namespace =
>> "http://www.example.com/task", elementFormDefault =
>> javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
>>
>> The package-info in the Task-Commons contains an XmlSchema annotation:
>> @javax.xml.bind.annotation.XmlSchema(namespace =
>> "http://www.example.com/commons", elementFormDefault =
>> javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
>>
>> The schemagen plugin generates two files, the first file contains the
>> Task element in the correct namespace, the second one contains the
>> Person element in the default namespace instead of the specified
>> namespace.
>>
>> With regards,
>>
>> [1] https://jaxb.dev.java.net/maven-jaxb-schemagen
>>
>> Nick Stolwijk
>> ~Java Developer~
>>
>> IPROFS BV.
>> Claus Sluterweg 125
>> 2012 WS Haarlem
>> http://www.iprofs.nl
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>
>