Generating schema for class files in a jar

View: New views
6 Messages — Rating Filter:   Alert me  

Generating schema for class files in a jar

by Nick Stolwijk-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
For additional commands, e-mail: users-help@...


Re: Generating schema for class files in a jar

by Wolfgang Laun-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The schemagen program processes source files only.
-W

On Mon, Sep 28, 2009 at 5:50 PM, Nick Stolwijk <nick.stolwijk@...> 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@...
For additional commands, e-mail: users-help@...



Re: Generating schema for class files in a jar

by Nick Stolwijk-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> wrote:

> The schemagen program processes source files only.
> -W
>
> On Mon, Sep 28, 2009 at 5:50 PM, Nick Stolwijk <nick.stolwijk@...>
> 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@...
>> For additional commands, e-mail: users-help@...
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Generating schema for class files in a jar

by Wolfgang Laun-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I was quoting from http://docs.sun.com/app/docs/doc/819-3669/6n5sg7bk1?a=view

It is, of course, possible that *some* information from a class file in the classpath
might find its way into the generated output. schemagen is bound to compile, and
then access the info from compiled class files, so this might account for producing
the complex type person, probably due to some import. But a package-info cannot
be imported.

-W

On Mon, Sep 28, 2009 at 6:08 PM, Nick Stolwijk <nick.stolwijk@...> wrote:
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@...> wrote:
> The schemagen program processes source files only.
> -W
>
> On Mon, Sep 28, 2009 at 5:50 PM, Nick Stolwijk <nick.stolwijk@...>
> 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@...
>> For additional commands, e-mail: users-help@...
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: Generating schema for class files in a jar

by Nick Stolwijk-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hmm, not nice. :( The XmlSchema annotation is a runtime annotation. It
should be possible to access this from jar files also. Any reason why
this isn't supported?

With regards,

Nick Stolwijk
~Java Developer~

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



On Mon, Sep 28, 2009 at 7:05 PM, Wolfgang Laun <wolfgang.laun@...> wrote:

> I was quoting from
> http://docs.sun.com/app/docs/doc/819-3669/6n5sg7bk1?a=view
>
> It is, of course, possible that *some* information from a class file in the
> classpath
> might find its way into the generated output. schemagen is bound to compile,
> and
> then access the info from compiled class files, so this might account for
> producing
> the complex type person, probably due to some import. But a package-info
> cannot
> be imported.
>
> -W
>
> On Mon, Sep 28, 2009 at 6:08 PM, Nick Stolwijk <nick.stolwijk@...>
> wrote:
>>
>> 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@...>
>> wrote:
>> > The schemagen program processes source files only.
>> > -W
>> >
>> > On Mon, Sep 28, 2009 at 5:50 PM, Nick Stolwijk <nick.stolwijk@...>
>> > 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@...
>> >> For additional commands, e-mail: users-help@...
>> >>
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Generating schema for class files in a jar

by Wolfgang Laun-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It sure can be accessed at runtime. But since schemagen appears to be defined
on source files, it just isn't done.

But feel free to raise an issue on https://jaxb.dev.java.net/. Be sure to
argue your case well :-)

-W


On Mon, Sep 28, 2009 at 7:32 PM, Nick Stolwijk <nick.stolwijk@...> wrote:
Hmm, not nice. :( The XmlSchema annotation is a runtime annotation. It
should be possible to access this from jar files also. Any reason why
this isn't supported?

With regards,

Nick Stolwijk
~Java Developer~

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



On Mon, Sep 28, 2009 at 7:05 PM, Wolfgang Laun <wolfgang.laun@...> wrote:
> I was quoting from
> http://docs.sun.com/app/docs/doc/819-3669/6n5sg7bk1?a=view
>
> It is, of course, possible that *some* information from a class file in the
> classpath
> might find its way into the generated output. schemagen is bound to compile,
> and
> then access the info from compiled class files, so this might account for
> producing
> the complex type person, probably due to some import. But a package-info
> cannot
> be imported.
>
> -W
>
> On Mon, Sep 28, 2009 at 6:08 PM, Nick Stolwijk <nick.stolwijk@...>
> wrote:
>>
>> 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@...>
>> wrote:
>> > The schemagen program processes source files only.
>> > -W
>> >
>> > On Mon, Sep 28, 2009 at 5:50 PM, Nick Stolwijk <nick.stolwijk@...>
>> > 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@...
>> >> For additional commands, e-mail: users-help@...
>> >>
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...