users@jaxb.java.net

ANT XJCTask and use of custom Plugin, causes ClassCastException

From: Luc <useyour.mind_at_gmail.com>
Date: Mon, 20 Aug 2012 09:23:00 +0200

Hello,

I've been using the ANT com.sun.tools.xjc.XJCTask provided in the JAXB-RI
version 2.1.13, to generate Java code. Now, I've found an extra need (use
namespace-prefixes) and I wanted to use a com.sun.tools.xjc.Plugin from the
JAXB2-commons (concretely,
this<http://java.net/projects/jaxb2-commons/pages/Namespace-prefix>
).
But as this forum post comments <http://www.java.net/node/676027>, when
using a custom plugin, in a different package than
com.sun.tools.xjc.addon.*fails throwing
ClassCastException.
This doesn't happen when using the xjc.bat command line with the same
values as the ANT task.
I've tested with JAXB-RI 2.1.13 and 2.2.6, and in both cases, fails with
the Ant task, and works in command line.

So, as workaround I could call directly the main class from
jaxb-xjc.jar(MANIFEST.MF says "Main-Class:
com.sun.tools.xjc.XJCFacade") with tags <arg value="">. But, I wanted to
raise this issue again, as forum seems dead.

Thanks,
--
Lucas