Reputation: 389
I use the maven cxf-xjc-plugin to generate java classes. It works, but the generated Java class names are not in camelcase.
XML Element name CT_Lieferung
is converted to CTLieferung.java
and not to CtLieferung.java
.
I want to, in a second step, convert some of the generated Java classes in Intellij with the JPA Entity from POJO
generator to JPA Entities. But the generator complains that the generated Java classes do not correspond to the Java naming style.
Is there an easy way to configure this globally in binding.xml? I don't want to configure every single element name.
Here are my plugin settings:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>3.3.4</version>
<executions>
<execution>
<id>xjc</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<sourceRoot>${basedir}/target/generated-sources/</sourceRoot>
<xsdOptions>
<xsdOption>
<xsd>${basedir}/src/main/resources/bipro/bipro-transfer-2.8.4.xsd</xsd>
<bindingFile>${basedir}/src/main/resources/binding.xml</bindingFile>
</xsdOption>
</xsdOptions>
</configuration>
</execution>
</executions>
</plugin>
Here is the binding.xml file
<?xml version="1.0" encoding="UTF-8"?>
<jxb:bindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb" version="2.1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:dt="http://www.bipro.net/namespace/datentypen">
<jxb:globalBindings enableJavaNamingConventions="true">
<jxb:javaType name="java.time.LocalDateTime" xmlType="dt:ST_Zeitstempel" printMethod="java.time.format.DateTimeFormatter.ISO_OFFSET_DATE_TIME.format" parseMethod="java.time.LocalDateTime.parse" />
<jxb:javaType name="java.time.LocalDateTime" xmlType="dt:ST_DatumZeit" printMethod="java.time.format.DateTimeFormatter.ISO_OFFSET_DATE_TIME.format" parseMethod="java.time.LocalDateTime.parse" />
<jxb:javaType name="java.time.LocalDate" xmlType="dt:ST_Datum" printMethod="java.time.format.DateTimeFormatter.ISO_OFFSET_DATE.format" parseMethod="java.time.LocalDate.parse" />
</jxb:globalBindings>
</jxb:bindings>
Upvotes: 0
Views: 11