I'm working on a related issue here, but I have a separate question. Perhaps it's all part of the same problem, but it seems different.
Because of the problems I'm having running XJC through the Ant task and through the facade, I'm now trying to run it with the command-line "xjc" tool from the JDK.
As in the original problem, I'm trying to use the "Element Wrapper" and "Fluent API" extensions, so my command line is the following:
xjc -extension -classpath "lib/jaxb-fluent-api-2.1.8.jar;lib/jaxb-xew-plugin-1.4.jar" -Xxew -summary target/xew-summary.txt -instantiate lazy -Xfluent-api schema/serviceCallResults.xsd
These are basically the same parameters I've been sending to the "cxf-jaxb-plugin" Maven plugin, which has been working for a long time. Unfortunately, this "xjc" command line fails with:
unrecognized parameter -Xxew
What might be wrong here?
This just does not work, sorry.
XJC plugins must extend the
com.sun.tools.xjc.Plugin
class. But the XJC which is included into JDK and available asxjc
binary (ex.xjc.exe
under Windows) is repackaged:com.sun.tools.xjc
->com.sun.tools.internal.xjc
.So in vanilla command line
xjc
you don't have thecom.sun.tools.xjc.Plugin
class (which XJC plugins extend) butcom.sun.tools.internal.xjc.Plugin
.So CLI
xjc
just does not work with XJC plugins. The only plugins which still work are those which are repackaged as well. (Ex.com.sun.tools.internal.xjc.addon.code_injector.PluginImpl
.)If do you want command line then try to figure out
java -cp ...
parameters, this is the only way to make it work with third-party XJC plugins like XEW or JAXB2-Basics.