users@jaxb.java.net

JAXB backward compatibility

From: <sergei_at_synopsia.net>
Date: Wed, 24 Sep 2014 04:00:44 -0400 (EDT)

Hi all,
 
Years ago I wrote an application that used JAXB to generate Java bindings for an
XML schema. The application code and the schema have been updated quite a lot
over the years, but the JAXB jars remained the same since 2008, which was when I
started using JAXB for this application. I've been using Ant to build the
application, including generating and compiling bindings, and everything worked
fine on at least two XP Pro development machines. I made some changes to the
schema and never had to think about JAXB.

Recently I tried to rebuild the application from scratch on a new laptop, and
the build keeps failing. The new 64-bit laptop is running windows 7 Pro, it had
a newer JDK (1.7.0_45) and a new version of Ant (1.9.3). I was able to get
around some weird problems by switching to a yet newer version of ant (1.9.4)
and switching to latest JAXB jars. At this point, I don't even remember what
those issues were (but I can recreate them by reverting to older JAXB jars in
SVN).

After upgrading JAXB, I ran into new problems. First of all, the xjc task in ant
seems to be interpreting the `target` attribute differently; it threw some error
and apparently the `destdir` has the semantic meaning that `target` used to
have.

Second, this task no longer generates the `impl` package with the implementation
classes whose names were supposed to end with `Type`, so the rest of my code
fails with a bunch of compilation problems.
 
Is there a way to make the new JAXB version backward-compatible? My other
options are try updating the code to work with the new bindings, which seems
like a lot of unnecessary work, or reverting to old JDK and Ant.
 
Thanks in advance for any advice.
 
Sergei