maven-jaxb2-plugin

XmlAdapter not working correctly with newer version of JAXB

≯℡__Kan透↙ 提交于 2019-12-05 12:13:15
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>> { @Override public PropertiesMap<String, String> unmarshal(Properties properties) throws Exception {

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

浪尽此生 提交于 2019-12-05 10:23:28
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"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>onebusaway-nyc</artifactId> <groupId>org

Unmarshalling Error: unexpected element (uri:url, local:“objectname”). Expected elements are <{}objectname>

人盡茶涼 提交于 2019-12-05 05:37:53
I'm using jaxb2-marshaller to generate classes to communicate with a webservice. Java-classes are generated with use of some wsdl files. Everything is okay now, but when I'm trying to use some of the generated classes, i got this unmarshalling error, altough I use the generated ObjectFactory classes. Some of the stack: org.springframework.ws.soap.client.SoapFaultClientException: Unmarshalling Error: unexpected element (uri:"http://xxxxxxxxx", local:"customer"). Expected elements are <{}customer> at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault

How to specify the JAXB version in maven-jaxb2-plugin?

淺唱寂寞╮ 提交于 2019-12-05 01:16:06
问题 I need to use the latest version jaxb: 2.2.4-1, but maven or maven-jaxb2-plugin seems to pick up the one from the JDK. I tried specifying the version like this: <configuration> <specVersion>2.2</specVersion> ... </configuration> but the logs read: [INFO] [jaxb2:generate {execution: common}] [INFO] Started execution. [INFO] JAXB API is loaded from the [jar:file:/opt/jdk1.6.0_24/jre/lib/rt.jar!]. [INFO] Detected JAXB API version [2.1]. I tried to add dependencies to the correct versions of

how to get maven-jaxws-plugin to generate @XmlElementWrapper on classes generated from xsd?

三世轮回 提交于 2019-12-04 23:58:39
问题 I am using maven-jaxws-plugin to generate java classes from my wsdl, schema. It is not generating the @XmlElementWrapper annotation in the generated classes. From this post I understand I nedd to use the jaxb-xew-plugin but am unable to get it working with the maven-jaxws-plugin. Any help would be appreciated. Here is the config I tried <plugin> <groupId>org.jvnet.jax-ws-commons</groupId> <artifactId>jaxws-maven-plugin</artifactId> <version>2.2</version> <executions> <execution> <goals> <goal

How can I get JAXB2 to emit CamelCase bindings?

安稳与你 提交于 2019-12-04 03:22:55
问题 I'm generating Java classes from a WSDL using the jaxws-maven-plugin's wsimport goal. Out of the box, this generates hideous classes and methods from the XML schema; e.g., a class called MYOBJECT from an XML element named MY_OBJECT. I've found that I can customize my JAXB2 bindings with an external file; this would be acceptable for a small number of classes and methods, but the overhead of manually naming everything in this case is undesirable. Some searching uncovers references to an XJC

maven-jaxb2-plugin reusing commons XSD within same project

青春壹個敷衍的年華 提交于 2019-12-03 20:19:29
问题 I have a project which has a schema A and B, both within the same namespace. Both import schema C which also uses the same namespace. How can I generate JAXB classes for A and B to separate packages, while reusing the JAXB classes from C generated to a commons package? I already know I should probably be using episodes and use the episode generated for schema C as bindings file for the separate executions of schema's A and B. Problem is I don't know how to refer to this generated episode file

how to get maven-jaxws-plugin to generate @XmlElementWrapper on classes generated from xsd?

心已入冬 提交于 2019-12-03 16:29:04
I am using maven-jaxws-plugin to generate java classes from my wsdl, schema. It is not generating the @XmlElementWrapper annotation in the generated classes. From this post I understand I nedd to use the jaxb-xew-plugin but am unable to get it working with the maven-jaxws-plugin. Any help would be appreciated. Here is the config I tried <plugin> <groupId>org.jvnet.jax-ws-commons</groupId> <artifactId>jaxws-maven-plugin</artifactId> <version>2.2</version> <executions> <execution> <goals> <goal>wsimport</goal> </goals> <phase>generate-resources</phase> <configuration> <xjcArgs> <xjcArg>-no

JAXB Bindings to schemas in a JAR

只谈情不闲聊 提交于 2019-12-03 16:14:17
I'm using the maven jaxb2 plugin to generate Java classes, built from schemas in a jar. However, I'm not sure how to correctly locate to these schemas from a bindings file. If Iextract the schemas from the jar and drop them in the same directory as the bindings, all is well. However, this isn't a practical long term solution. pom.xml: <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <version>0.8.1</version> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <schemas> <schema>

How to generate JaxB-Classes with java.util.Optional?

夙愿已清 提交于 2019-12-03 06:51:53
I use the jaxb2-maven-plugin to generate JaxB-Classes from a given XSD. It works fine. But now I want to use java.util.Optional in the generated Classes. But JaxB generated the Classes without the Optionals. So I'm forced to make a Null-Check of every Variable. Did anybody know how the jaxb2-maven-plugin has to be configured to use the java.util.Optional? Thanks for you help! Maybe you could find something more generic but i'm not sure if this is possible. Anyway you can still define custom Adapter for types you want to be optional. Here is an example of Integer First, create an Adapter public