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
152 questions
21
votes
5 answers

Generate classes with jaxb2-maven-plugin from WSDL

I am having trouble configuring the jaxb2-maven-plugin to generate Java classes from a WSDL and multiple XSD files that all exist in the same standard directory src/main/xsd. how to use jaxb2 maven plugin with inline XSD? is related only in that the…
andyb
  • 42,062
  • 11
  • 113
  • 146
16
votes
1 answer

How to generate java classes into source folder using jaxb2-maven-plugin?

I use jaxb2-maven-plugin to generate java classes. There is plugin properties: org.codehaus.mojo jaxb2-maven-plugin 2.3
May12
  • 2,090
  • 11
  • 49
  • 91
12
votes
2 answers

Is there a JAXB Plugin which generates Builders?

Are you aware of any good JAXB Plugin which generated Builder pattern classes for the generated JAXB classes? Composing domain using JAXB generated classes is really nasty. I saw a plugin someone wrote back in 2010 but it doesn't use the newest…
Asaf Mesika
  • 1,533
  • 4
  • 17
  • 33
10
votes
5 answers

XJC Maven Plugin(jaxb2-maven-plugin) Java 11 Migration Issues

I am currently working on java 11 migration project where jaxb2-maven-plugin has been used for XJC task. As XJC executable is not present in the JDK 11 version, I am getting below mentioned errors. [ERROR] Failed to execute goal…
Syam Kumar
  • 385
  • 2
  • 4
  • 15
10
votes
1 answer

How to run XJC with Java 11 and maven?

To generate java classes from XSD (for reading XML files), we used jaxb2-maven-plugin and Java8. For java 11, we get many issues... What libraries and plugins do work (today), allowing to generate java code from XSD using java 11 and maven? If…
Walter Kuhn
  • 419
  • 5
  • 17
9
votes
1 answer

Append CDATA using org.springframework.oxm jaxb2marshaller

I am having big trouble while marshaling few elements to XML with CDATA using jaxb2marshaller. I have gone through the solutions like: JAXB Marshalling Unmarshalling with CDATA How to generate CDATA block using JAXB? and much more, but could not…
ani0710
  • 256
  • 2
  • 18
9
votes
2 answers

JAXB fails to generate Java classes for XBRL

I'm trying to generate Java classes for types defined in XBRL. My build process is based on Maven 2, and here are my trials. I only paste the build section, which relies on some properties: package is the name of my target package catalog is the…
rds
  • 24,304
  • 16
  • 97
  • 124
6
votes
1 answer

JAXB schemagen doesn't reference classes in episode file

I am actually using a schema first approach, however I hit a roadblock with the "ominous" JAXB Map problem! and worked around it by switching to a code first approach for this one. Now I'd like to reuse this type in other modules and continue my…
Mirko Jahn
  • 1,262
  • 1
  • 9
  • 15
6
votes
3 answers

org.codehaus.mojo : jaxb2-maven-plugin : 1.6 --> API incompatibility was encountered

when using jaxb2-maven-plugin from codehaus i get the following problem marker in eclipse the content of this marker contains the following: Description Resource Path Location Type Execution configuration of goal…
jkp
  • 83
  • 1
  • 4
5
votes
1 answer

Empty lines in generated XSD

I'm trying to generate schema files from some Java classes using jaxb2-maven-plugin(version 2.5.0). I'm getting the schema1.xsd file without any warnings, but it contains extra empty lines:
NeplatnyUdaj
  • 5,471
  • 4
  • 38
  • 70
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
2 answers

maven-jaxb2-plugin VS jaxb2-maven-plugin for multiple schemas

I have multiple xsd schemas that I want to unmarshall into different packages under the same folder target/generated-sources/xjc. I tried both plugins and both seem to work fine with these 2 configurations but in case of maven-jaxb2-plugin the…
Tinou
  • 5,127
  • 4
  • 18
  • 22
5
votes
1 answer

remove xmlns attribute from the root element while marshalling jaxb

This might be a related to JAXB Marshaller - How do I suppress xmlns namespace attributes? But my problem is a little different. I do the regular java marshalling and my xsd has no namespaces.The generated xml is without namespaces as well, except…
icedek
  • 524
  • 1
  • 11
  • 28
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
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
1
2 3
10 11