Questions tagged [jaxb2-maven-plugin]

This plugin uses JAXB2 to generate Java classes from XML Schemas (and binding files) and to create XML Schemas for existing Java classes.

The Java Architecture for XML Binding (JAXB) enables translation between Java classes and XML documents. JAXB2 is specified by JSR-222.

The JAXB-2 Maven Plugin requires Maven 2+ and JDK 1.5+ and makes use of the JAXB Binding Compiler (xjc)

The plugin defines two main goals (see official documentation for more goals)

  • jaxb2:xjc - runs the xjc compiler to generate Java classes from XML Schema(s) and binding file(s)
  • jaxb2:schemagen - generates XML Schemas from JAXB annotated Java classes
173 questions
5
votes
1 answer

Java Code generation from XSD/WSDL for Jakarta 4.0.0 using Maven Plugin

I have wasted mutiple days trying to figure it out, how can something that seems pretty straightforward (generating code from a WSDL/XSD) be so extremly complicated. Are there any approaches? I feel I have tried them all, in diffrent versions using…
5
votes
1 answer

How do I tell Maven to not disregard namespace attribute in imported XSD?

I am using the mojohaus jaxb2-maven-plugin to generate Java sources out of xsd schema files. My pom.xml looks like this: ... org.codehaus.mojo jaxb2-maven-plugin
Matthias
  • 440
  • 3
  • 16
5
votes
2 answers

How do I define schema directory in JAXB2 maven plugin version 2.4?

I am trying to define the directory for my schema in my pom.xml. I keep getting an error saying "Element schemaDirectory is not allowed here". I am guessing this element is not supported in this version. So how do define my schema directory in this…
QThompson
  • 1,599
  • 3
  • 16
  • 40
5
votes
1 answer

maven-jaxb2-plugin fails with JAXB version attribute must be present

I have the following configuration for maven-jaxb2-plugin: org.jvnet.jaxb2.maven2
5
votes
1 answer

IntelliJ bindingDirectory for jaxb-maven-plugin

I want to add globalBinding for my schema.xsd generated types, in a seperate schema.xjb binding file. I am using IntelliJ and am not sure if this problem is maven or Intellij doing (cause this example runs as expected in eclipse for instance). The…
Spase Markovski
  • 653
  • 1
  • 8
  • 22
5
votes
3 answers

Packages are getting deleted while Generating Jaxb classes Using Maven and generated maven package name is incorrect

I tried to generate Jaxb Classes from XSD using jaxb2-maven-plugin. I am able to get the jaxb classes in a package but my other packages are getting deleted. What is the reason for this? How to over come this? please can you give suggestions. Below…
buttowski
  • 4,657
  • 8
  • 27
  • 33
5
votes
1 answer

schemagen.exe generates xsd schema with non-determined order of

I used org.codehaus.mojo jaxb2-maven-plugin to generate xsd schema for my classes. Plugin site http://mojo.codehaus.org/jaxb2-maven-plugin/faq.html tell, that plugin uses JDK utility schemagen.exe to do generation. Problem is that order in…
Dmitry
  • 61
  • 1
4
votes
0 answers

How to generate plural names with jaxb2

I did find How do you customize how JAXB generates plural method names? , but the question is over 10 years old now and since I had to change my binding to Jakarta the accepted answer doesn't work for me anymore. (Altho I'm not really familiar with…
Aelion
  • 379
  • 1
  • 5
  • 16
4
votes
1 answer

Generate valid XML from classes generated with XSD

Goal I'm trying to generate a XML that validates against a given XSD by marshalling an object created with classes generated with said XSD. Note that I cannot modify the XSD and I don't want to edit the generated classes. Example foo.xsd
4
votes
2 answers

Using XJB with jaxb2-maven-plugin

I have a multi-module maven project in the following structure: root-module |__module-a | |__src | |__main | |__xsd | | |__my.xsd | |__xjb | |__my.xjb …
Neel
  • 2,100
  • 5
  • 24
  • 47
4
votes
1 answer

How to customize the field name of the generated Java object using JAXB custom bindings?

I'm trying to generate JAXB generated objects for the below sample xsd. and the class…
KumarRaja
  • 121
  • 4
  • 9
4
votes
1 answer

How to document a type in enunciate?

How to get the description field on a type populated in the generated enunciate documentation? We are generating classes from jaxb using jaxb2-maven-plugin. No matter how I document a element either using the
Peter
  • 5,556
  • 3
  • 23
  • 38
3
votes
1 answer

JAXB2 Maven Plugin xjc parse error: org.xml.sax.SAXParseException: Unexpected appears

I want to use JAXB2 maven plugin to generate Java Objects from WSDL file to consume a soap service as a client. When I use this plugin as "jaxb2:generate" and configuration below: ...
Yigithankadir
  • 41
  • 1
  • 7
3
votes
0 answers

Maven Jaxb plugin implClass binding not working

I have a class Task that was generated by the jaxb2-maven-plugin using a XML schema. Here is the schema:
Michael Pacheco
  • 948
  • 1
  • 17
  • 25
3
votes
0 answers

How to bind schema with jaxb2 for duplicated element name

I'm trying to generate a java classes from multiple xsd files. In these schemas files there are multiple complexType or elements with the same name in different schemas. Please note that I'm unable to change the schemas. I created a binding file,…
user311633
  • 173
  • 3
  • 11
1
2
3
11 12