[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.

4.00 avg. rating (86% score) - 1 vote
November 6, 2015
||||||

Related Posts

Leave a reply


This website stores some user agent data. These data are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to opt-out of any future tracking, a cookie will be set up in your browser to remember this choice for one year. I Agree, Deny
646