[Java] Make XJC maven tasks generate serializable JAXB classes

While using ehcache to cache RESTful calls to webservices, i dealt with the problem, that ehcache was sometimes not able to cache generated my xjc generated java classes from xsd, because in default they are not implementing the serializable Interface.

To fix this i found a simple solution by adding the bindung element and usind a global binding.

and adding:

So the resulting maven task looks like this:

Now the generated classes implement the Serializable interface and can be used in ehCache.

November 6, 2015

Related Posts

Leave a reply