Posted by kohsuke
on January 30, 2007 at 9:44 AM PST
Maven JAXB2 plugin is a great tool if your build is based on Maven2. It can compile any schema languages that XJC supports, and you can use available XJC plugins, too.
Glassfish v3 is going to be based on Maven2, and I've been helping them to get it right. One of the work is to invoke JAXB's schema compiler to compile a DTD with XJC plugins. Once you know what to do, this is easy thanks to the excellent maven-jaxb2-plugin .
As with everything else in Maven, the hard part is to know how to do it. I thought this example might be useful for other folks, so decided to post it here. The crucial portion is the plugin configuration in :
The dependencies section inside the plugin element can be used to specify additional XJC plugins. If you'd like to use more recent version of the JAXB RI, you can specify a dependency to XJC here to do so, like this:
The complete sample project is also available.