JAXB and unmappable character for encoding UTF-8

Using locale specific characters in schema or wsdl (i.e. for documentation purpose) is still quite problematic. Especially if you are using JAXB to generate wsdl2java java classes. Because JAXB uses default system encoding and classes are usually compiled in UTF-8 special chars in java comments resolves in compilations error:

/url/to/file/SomeFile.java:[11,12] unmappable character for encoding UTF-8 A workaround to this problem is to isolate wsdl2java code generation in a dedicated maven module and to configure the compiler plugin to use OS dependant encoding:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>${file.encoding}</encoding>
</configuration>
</plugin>
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <encoding>${file.encoding}</encoding> </configuration> </plugin>
<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <encoding>${file.encoding}</encoding>
        </configuration>
</plugin>

More info related to this topic:

here

You May Also Like

Complex flows with Apache Camel

At work, we're mainly integrating services and systems, and since we're on a constant lookout for new, better technologies, ways to do things easier, make them more sustainable, we're trying to Usually we use Apache Camel for this task, which is a Swis...At work, we're mainly integrating services and systems, and since we're on a constant lookout for new, better technologies, ways to do things easier, make them more sustainable, we're trying to Usually we use Apache Camel for this task, which is a Swis...