maven-jaxb2-plugin

Generating java classes using maven-jaxb2-plugin

无人久伴 提交于 2019-12-10 18:55:24
问题 I am very new to Jaxb and this maven-jaxb2 plugin Here is my .xsd file : <xs:element name="user" type="user" /> <xs:element name="userList" type="userList" /> <xs:complexType name="user"> <xs:all> <xs:element name="id" type="xs:long" minOccurs="0" /> <xs:element name="name" type="xs:string" /> <xs:element name="registrationDate" type="xs:dateTime" /> </xs:all> </xs:complexType> <xs:complexType name="userList"> <xs:sequence> <xs:element name="user" type="user" minOccurs="0" maxOccurs=

Avoiding Compiler warnings on code generated by xjc

北战南征 提交于 2019-12-10 16:49:44
问题 My root question is how to benefit from the 'unchecked generics type' Eclipse compiler warning, but not have the list of those warnings in the Problems view polluted by noise from java classes which are generated from xsd files by xjc (via maven-jaxb2-plugin.) I've read other places that I can ignore compiler warnings per source folder and that would be great, but I don't have the authority to place the generated code it it's own source folder. :( Given my situation, my assumption is that the

JAXB episode compilation with include does not work

徘徊边缘 提交于 2019-12-10 13:43:23
问题 I have 2 schemas A, B. I'm reusing some A elements in B. I do not use namespaces. I'm using <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <version>0.9.0</version> I have have defined an inclusion of schema A in schema B as: <xs:include schemaLocation="classpath:my.schema.A.xsd"/> and the catalog as REWRITE_SYSTEM "classpath:my.schema.A.xsd" "maven:my.schema:schema-a!/A.xsd" The jaxb configuration goes: <configuration> <generatePackage>my.schema.b<

JAXB - marshalling with recursive dependency

眉间皱痕 提交于 2019-12-08 09:15:44
is anybody try to marshal JAXB object with recurisive referency? I have following class: public class A { private Long id; private String name; private List<A> aList; } and I'd like to marshall it to: <a> <a> <a>...</a> ... </a> ... </a> I'm using maven plugin to auto generate JAXB class from XSD. Any suggestions? Below is how you can support this use case starting from your XML schema. XML SCHEMA (schema.xsd) The following XML schema is based on the comment you made to a previous answer (http://stackoverflow.com/a/14317461/383861). <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs=

JAXB - marshalling with recursive dependency

筅森魡賤 提交于 2019-12-08 04:46:49
问题 is anybody try to marshal JAXB object with recurisive referency? I have following class: public class A { private Long id; private String name; private List<A> aList; } and I'd like to marshall it to: <a> <a> <a>...</a> ... </a> ... </a> I'm using maven plugin to auto generate JAXB class from XSD. Any suggestions? 回答1: Below is how you can support this use case starting from your XML schema. XML SCHEMA (schema.xsd) The following XML schema is based on the comment you made to a previous answer

packagename doesnt contain ObjectFactory.class or jaxb.index

Deadly 提交于 2019-12-07 22:56:12
问题 While deploying my project to a tomcat-server, I get constantly this exception: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshaller': Invocation of init method failed; nested exception is org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is javax.xml.bind.JAXBException: "be.icredit.einvoice.proxy.customerdaoservice" doesnt contain ObjectFactory.class or jaxb.index But it does have an

Class reuse with JAXB bindings don't honour SimpleTypes

梦想与她 提交于 2019-12-07 14:50:15
问题 I'm trying to reuse classes that are already compiled and available. This looks to be achievable by declaring bindings to the pre-existing classes as per example bindings extract below:- <jaxb:bindings schemaLocation="MyExample.xsd"> <jaxb:bindings node="//xs:simpleType[@name='MySimpleType']"> <jaxb:class ref="com.example.MySimpleType" /> </jaxb:bindings> <jaxb:bindings node="//xs:complexType[@name='MyComplexType']"> <jaxb:class ref="com.example.MyComplexType" /> </jaxb:bindings> </jaxb

XmlAdapter not working correctly with newer version of JAXB

狂风中的少年 提交于 2019-12-07 11:43:55
问题 I'm executing a Maven Project with the below source package com.coderplus.jaxb; import java.util.HashMap; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; @XmlJavaTypeAdapter(PropertiesMapAdapter.class) public class PropertiesMap<K,V> extends HashMap<String,String> { } .. package com.coderplus.jaxb; import java.util.Map.Entry; import javax.xml.bind.annotation.adapters.XmlAdapter; public class PropertiesMapAdapter extends XmlAdapter<Properties, PropertiesMap<String, String>> {

xjc, maven-jaxb2-plugin: cryptic java.lang.NoSuchMethodException: javax.xml.bind.annotation.XmlElementRef.required()

扶醉桌前 提交于 2019-12-07 04:10:20
问题 I'm attempting to use maven-jaxb2-plugin to compile the XSDs at http://www.aptatcip.com/APTA-TCIP-S-01%204.0_files/Schema%20Set.zip Using this pom.xml , and the command line below (run from the parent folder), the compilation fails with a fairly cryptic error message (also given below): pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

packagename doesnt contain ObjectFactory.class or jaxb.index

跟風遠走 提交于 2019-12-06 05:02:10
While deploying my project to a tomcat-server, I get constantly this exception: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshaller': Invocation of init method failed; nested exception is org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is javax.xml.bind.JAXBException: "be.icredit.einvoice.proxy.customerdaoservice" doesnt contain ObjectFactory.class or jaxb.index But it does have an ObjectFactory.class! Im using Spring, Maven and Jaxb2 My POM: <project xmlns="http://maven.apache.org/POM/4.0