users@jaxb.java.net

Re: ANT XJCTask and use of custom Plugin, causes ClassCastException

From: Luc <useyour.mind_at_gmail.com>
Date: Mon, 20 Aug 2012 10:22:50 +0200

*Update: *As I told here <http://www.java.net/node/676027#comment-825101>,
the workaround is not calling main-class, and calling the
jaxb-xjc.jarinstead (with
fork="true").
Is less clean and less readable, but it works....

Thanks,
--
Lucas
2012/8/20 Luc <useyour.mind_at_gmail.com>
> 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
>
>
>