ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Trouble trying to use xjc from JAXB 2 with Ant 1.7.1
Date Tue, 09 Feb 2010 19:32:55 GMT
I'm having some annoying classpath problems trying to do something
relatively simple, just running the "xjc" task from a small Ant build

I'm using JDK 1.5 and Ant 1.7.1.

I'm seeing the following exception when I try to run xjc:


I think some of the elements that are involved here are:

* Ant has its own jaxb/xjc classes in "ant.jar"
* There appear to be multiple jar sets of "jaxb 2", and I don't know
which one is which

A couple days ago I had to write a build script to do just about the
same thing, generating a client jar from a schema.  I thought I had the
latest jaxb jars in the project lib dir.  This had no trouble at all.
It generated the client jar with no errors.

Then, I started work on the client jar build on the other project, which
at the time was using at least a different copy of the jaxb jars.  That
hit the NCDFE shown above.

After I went back and looked at the first project that worked fine, I
discovered I had accidentally specified the wrong path to the "xjc" jar
in my lib directory, so that reference wasn't finding anything.  When I
changed the reference to match the file name, that original project then
started getting the same NCDFE.

I then turned on verbose class loading in ANT_OPTS, which told me that
Ant had its own versions of the jaxb/xjc classes.  I don't know whether
they're "wrong", just "different".  I suppose it's possible they're the
JAXB "1" classes, but I don't know.

I also tried adding the Ant "-verbose" command line arg.  This gave me
some useful info when it tried to run "xjc".  When I can get "xjc" to
work, I see the following in the build output:

  build id of XJC is hudson-jaxb-ri-2.1-257

When I get the NCDFE, I get this:

  build id of XJC is hudson-jaxb-ri-2.1-833

I then tried running Ant with a "-lib" command line argument, specifying
the path to the jaxb jars that I'm TRYING to use.  I did this in both
projects.  This worked, in both projects.  Unfortunately, this isn't
really a reasonable workaround for me.

What can I do to get this to just work, without any serious hacks?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message