I am struggling to get the simplest of jax-b plugins working. Ultimately I
would like to write a plugin that uses interfaces for objects it defines,
and creates a factory for instantiation. Basically we have the problem that
we have many schemas that we are provided that are nearly identical, but not
quite. I would like to hide the implementation of each marshelled schema
behind interfaces and factories so that the code we write is none-the-wiser.
Looking at the users list here, it seems that a custom plugin is the ticket.
So I started by writting a stubbed out plugin that just prints the method
name. I just want to see that the plugin is getting executed. I then compile
and jar it up according to the documentation and create a META-INF/services
file called com.sun.tools.xjc.MyPlugin which contains the fully qualifed
name of my plugin.
Then I try to run XJC:
<path id="custom.jaxb.path">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${java.home}/lib/tools.jar"/>
<fileset dir="C:/dev/java/jaxb-ri-20051003/lib">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask"
classpathref="custom.jaxb.path">
</taskdef>
<target name="build">
<xjc target="${src.dir}" readonly="true"
package="org.mytest.foo"
schema="schema/message/efileMessage.xsd">
<arg line="-foo"/>
<arg line="-Xverification"/>
</xjc>
</target>
You can see that I set the optionName to foo. When this did not work (I get
"unrecognized parameter -foo"), I downloaded jaxb-verification and tried
that too. For grins I looked at how their plugin was created and how the
services file was defined to make sure I did not have any inconsistancies.
Basically I cannot get any plugins to work with the latest JAX-B EA3
release. I know I must be doing something wrong since others seem to be able
to get this to work.
Any help would be greatly appreciated.
--
Cosmicnonplusation - The feeling of being infinitely small in an infinitely
large universe.