Thursday, August 16, 2012

A few quick lessons about Gradle, Jaxb, and XML

It surprising how much certain kinds of little roadblocks can slow you down. So I thought I'd mention my Gradle/Jaxb/XML woes of late in hopes they'd be helpful.

First, it appears as though the element name in XSD files is case sensitive in some tools and not in others. This means that when I took an (apparently functional) XSD and tried to run it through ant xjc (using gradle) it broke.

Java has a limit to the length of a qualified classname. According to stack overflow it is 64k. I never imagined I'd need to know that little factoid. But it turns out that one of my schemas has such a deep definition of types, that it exceeds this limit. The error warning isn't especially helpful.

Finally, I needed a feature in the jaxb plugin that wasn't available. So I implemented it. GitHub and the open ethic is amazing. It wasn't long ago when fixing adding a feature to a project on a whim would have been a serious undertaking. Instead, it was a pleasure to get my hands dirty and improve a project that had improved my project. That's the best kind of paybacks!