[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

Related Posts

Leave a reply