mojohaus / jaxb2-maven-plugin

JAXB2 Maven Plugin
https://www.mojohaus.org/jaxb2-maven-plugin/
Apache License 2.0
107 stars 77 forks source link

How to add custom annotation for xsd:complexType ? #186

Open mathan26 opened 2 years ago

mathan26 commented 2 years ago

When generating Java class from XSD , I need to add @XmlRootElement for xsd:complexType classes.

Currently, I am able to do with the external plugins,

 <dependency>
      <groupId>org.jvnet.jaxb2_commons</groupId>
      <artifactId>jaxb2-basics-annotate</artifactId>
      <version>1.1.0</version>
  </dependency>

in the configuration,

<xjbSource>src/main/resources/test.xjb</xjbSource>
 <arguments>
    -Xannotate
</arguments>

Question:

  1. Is there any other way I can able to annotate the generated class with annotation?
  2. https://www.mojohaus.org/jaxb2-maven-plugin/Documentation/v2.4/xjc-mojo.html#arguments what is the alternative for since it is deprecated?
Tokimimo commented 1 year ago

Any updates or remarks on this? Am I missing some documentation or is this not a problem for many?

Using the generated classes in Spring web service 3.0.0 creates this problem with the xsd I have to work with: unable to marshal type "Ping" as an element because it is missing an @XmlRootElement annotation