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
1
vote
1 answer

JAXB2 generates getters/setters with primitive types for optional attributes

We are using jaxb2 to generate Java code from xml schema definitions for some external data. The project is quite old and used the maven-jaxb-plugin 1.1.1. We want to update to jaxb2-maven-plugin which will also use jaxb2, but we found some…
Jens
  • 9,058
  • 2
  • 26
  • 43
1
vote
1 answer

SunCertPathBuilderException => Maven JAXB2 generation with certificate

I'm using maven-jaxb2, to generate classes to make calls to a webservice. org.jvnet.jaxb2.maven2 maven-jaxb2-plugin 0.12.3
Kornelito Benito
  • 1,067
  • 1
  • 17
  • 38
1
vote
1 answer

Error: Not supported: indent-number when using jaxb2-maven-plugin with jdk8

I have a project that was compiled with java6. It uses jaxb2-maven-plugin to generate XSD for web services. I am trying to port this project to compile/run with java8. In order to do that, I upgraded the jaxb2-maven-plugin version from 1.3.1 to…
feroze
  • 7,380
  • 7
  • 40
  • 57
1
vote
1 answer

How to generate classes for XSD in Maven src/test, that reference XSD in src/main

The following maven setup: src/main/resources/BaseTypes.xsd src/test/resources/MyTypeUsingBaseTypes.xsd Now I would like to have the BaseTypes generated into target/classes, while the MyTypeUsingBaseTypes into target/test-classes. The problem is,…
girafi
  • 131
  • 7
1
vote
0 answers

JAXB2 fails to generate sources from two WSDLs that have duplicate types

I'm trying to use JAXB2 2.2 to generate sources from WSDL files. The WSDL files come from a third party and they all define the same common types in addition to a type specific to that WSDL. If I have only one WSDL in the source folder (let's call…
Egor
  • 1,622
  • 12
  • 26
1
vote
1 answer

jaxb2-maven-plugin to report problems on Console

I have a maven-based build script that runs jaxb2-maven-plugin (schemagen) to generate XSD from Java classes. I have done something wrong and it won't generate it. The project is very complex and it is difficult to re-create in console the exact…
onkami
  • 8,791
  • 17
  • 90
  • 176
1
vote
1 answer

JAXB bindings of complex type to new classname

I'm trying to map the following to a new class name via the maven-jaxb2-plugin. I have this element that exists in two XSD's in the project (different namespaces). I want to map this instance to a different classname so that it…
jeff porter
  • 6,560
  • 13
  • 65
  • 123
1
vote
1 answer

jaxb2-maven-plugin throws Exception when maxOccurs is greater than 5000

When I run the jaxb2-maven-plugin on a legacy xsd it throws this Exception: Current configuration of the parser doesn't allow a maxOccurs attribute value to be set greater than the value 5,000 Googling this error shows that this is a limit that was…
Dean Schulze
  • 9,633
  • 24
  • 100
  • 165
1
vote
1 answer

JAXBElement generated even with generateElementProperty to false

I generate types in a WSDL using xjc maven plugin. Following my configuration : org.codehaus.mojo jaxb2-maven-plugin 1.5
P. Ekouaghe
  • 214
  • 5
  • 10
1
vote
1 answer

How to re-use jaxb bindings for multiple xsds?

I'm trying to figure out a way for how to use the same .xjb bindings file for multiple xsd files. I found a solution here for "floating global bindings": https://www.java.net/node/674443 However, the stuff I'm trying to do does not seem to be…
mac
  • 2,672
  • 4
  • 31
  • 43
1
vote
1 answer

maven plugin - jaxb - Creating JAXB Classes

I am using JAXB plugin and need to generate classes for at least a dozens schema. How would i dynamically create packages corresponding to each schema ? schema 1 -> package x.y.z.schema1 schema 2 -> package x.y.z.schema2..... The style mentioned…
user1428716
  • 2,078
  • 2
  • 18
  • 37
1
vote
1 answer

Which attribute in XSD will annotate a field with @XmlElement(required = false) in JAXB generated classes

I want to annotate a field in my jaxb generated class with this annotation - @XmlElement(required = false). Which attribute in the XSD would generate my field with this annotation?. I can't hand type this as the JAXB classes are auto generated…
Ganga Aloori
  • 50
  • 1
  • 1
  • 6
1
vote
0 answers

jaxb:bindings, Separating classes from wsdls (the same location, and different target namespaces). What about wsdlLocation attribute?

I have two wsdls: ServiceA.wsdl(with targetNamespace='targetA'), and ServiceB.wsdl(with targetNamespace='targetB'). Both of them, are located in the same location, but each of them belongs to different target namespace. I'd like to separate java…
1
vote
1 answer

Can I include java source from multiple projects when running schemagen using the jaxb2-maven-plugin?

I have a multi module maven project and I need to build an XML schema from JaxB annotated classes. These classes are in different maven projects. Can I use the jaxb2-maven-plugin to generate a single schema by pointing at the source from all of…
RJC
  • 375
  • 4
  • 11
0
votes
0 answers

Jaxb3x bindings issue- Unsupported binding namespace "http://jaxb2-commons.dev.java.net/basic/inheritance"

Upgrading to jaxb jakarta i'm getting issue with inheritence namespace. Purpose: Converting xsd to java files My xjb file:
SreeNath
  • 91
  • 1
  • 4