Skip to content

Instantly share code, notes, and snippets.

@dilnei
Last active July 28, 2016 20:35
Show Gist options
  • Save dilnei/1aac85527bd69d76dc306da66a350b99 to your computer and use it in GitHub Desktop.
Save dilnei/1aac85527bd69d76dc306da66a350b99 to your computer and use it in GitHub Desktop.
Generating Java classes by jaxb2-maven-plugin with multiple executions and without warnings of the EnumMemberSizeCap limit using binding.xml
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<xjbSources>
<xjbSource>src/main/resources/binding.xjb</xjbSource>
</xjbSources>
</configuration>
<executions>
<execution>
<id>PL_008i1_CFOP_EXTERNO</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/main/resources/PL_008i1_CFOP_EXTERNO/leiauteInutNFe_v3.10.xsd</source>
<source>${basedir}/src/main/resources/PL_008i1_CFOP_EXTERNO/leiauteNFe_v3.10.xsd</source>
<source>${basedir}/src/main/resources/PL_008i1_CFOP_EXTERNO/nfe_v3.10.xsd</source>
</sources>
<verbose>false</verbose>
<extension>true</extension>
<removeOldOutput>false</removeOldOutput>
<packageName>br.inf.portalfiscal.nfe.v3</packageName>
<encoding>UTF-8</encoding>
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
<execution>
<id>PL_006s</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/main/resources/PL_006s/nfe_v2.00.xsd</source>
<source>${basedir}/src/main/resources/PL_006s/procCancNFe_v2.00.xsd</source>
</sources>
<verbose>false</verbose>
<extension>true</extension>
<removeOldOutput>false</removeOldOutput>
<packageName>br.inf.portalfiscal.nfe.v2</packageName>
<encoding>UTF-8</encoding>
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
<execution>
<id>PL_005d</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/main/resources/PL_005d/nfe_v1.10.xsd</source>
</sources>
<verbose>false</verbose>
<extension>true</extension>
<removeOldOutput>false</removeOldOutput>
<packageName>br.inf.portalfiscal.nfe.v1</packageName>
<encoding>UTF-8</encoding>
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
<execution>
<id>PL_005f</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/main/resources/PL_005f/nfe_v1.10.xsd</source>
</sources>
<verbose>false</verbose>
<extension>true</extension>
<removeOldOutput>false</removeOldOutput>
<packageName>br.inf.portalfiscal.nfe.v1f</packageName>
<encoding>UTF-8</encoding>
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
<execution>
<id>Evento_Canc_PL</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/main/resources/Evento_Canc_PL/leiauteEventoCancNFe_v1.00.xsd</source>
<source>${basedir}/src/main/resources/Evento_Canc_PL/procEventoCancNFe_v1.00.xsd</source>
</sources>
<verbose>false</verbose>
<extension>true</extension>
<removeOldOutput>false</removeOldOutput>
<packageName>br.inf.portalfiscal.nfe.eventocancelamento</packageName>
<encoding>UTF-8</encoding>
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
<execution>
<id>Evento_CCe_PL</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/main/resources/Evento_CCe_PL/leiauteCCe_v1.00.xsd</source>
<source>${basedir}/src/main/resources/Evento_CCe_PL/procCCeNFe_v1.00.xsd</source>
</sources>
<verbose>false</verbose>
<extension>true</extension>
<removeOldOutput>false</removeOldOutput>
<packageName>br.inf.portalfiscal.nfe.eventocartacorrecao</packageName>
<encoding>UTF-8</encoding>
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
</executions>
</plugin>
// scr/main/resoorces
<?xml version="1.0" encoding="UTF-8"?>
<jxb:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" version="2.1">
<jxb:bindings>
<jxb:globalBindings typesafeEnumMaxMembers="2000" />
</jxb:bindings>
</jxb:bindings>
Do not forget to update the package on the maven run a clean install because it is discouraged to use forceRegenerate
https://github.com/highsource/maven-jaxb2-plugin/wiki/Do-Not-Use-forceRegenerate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment