Hi,
I was trying to create my own plugin, using option of "-inject-code", so
it can be differentiated from the "-Xinject-code" from the JAXB.
So:
com.sun.tools.xjc.addon.code_injector.PluginImpl -> -Xinject-code
mycodeinjector.PluginImpl -> -inject-code
What confused me is,
When the file "META-INF/services/com.sun.tools.xjc.Plugin" containing
only "com.sun.tools.xjc.addon.code_injector.PluginImpl", the
code_injector.PluginImpl (-Xinject-code) works well.
But when I add another line,
So it become:
com.sun.tools.xjc.addon.code_injector.PluginImpl
mycodeinjector.PluginImpl
, even the code_injector.PluginImpl (-Xinject-code) cannot be used.
And as this is just to try whether it works, I don't care to much about
the name.
Thanks for your advice.
I think, I will try to move to use the building tools.
Regards,
Heru
-----Original Message-----
From: Aleksei Valikov [mailto:valikov_at_gmx.net]
Sent: Friday, November 10, 2006 2:02 PM
To: users_at_jaxb.dev.java.net
Subject: Re: JAXB Plugin
Hi.
> Thanks lexi.
> I've refined my work.
> Now I'm trying to create my "dummy plugin" which the content is just
> the same as code injector, just adding a line of println inside the
> run method of the PluginImpl class.
>
> Here are my steps:
> 1. Add the line "System.out.println("A");" inside method run of
> PluginImpl.java 2. Change the getNameOption to returning String
> "inject-code"
Should be "Xinject-code".
> 3. change the package name to "package mycodeinjector", also the in
> file Const.java
I'd choose a more meaningful package name, but that's your choice.
> 4. Save the file inside folder mycodeinjector 5. I compiled it.
> 6. Adding line "mycodeinjector.PluginImpl" in file
> META-INF/services/com.sun.tools.xjc.Plugin
> 7. Creating the jar files using command
> jar -cf plugin.jar META-INF mycodeinjector/*.class 8. Change the
> build file to use argument of "-inject-code"
Should be -Xinject-code.
> Now it cause error message, "unrecognized parameter -inject-code"
> Even when I change the build file to use argument of "-Xinject-code",
> which did work, it showed an error message of "unrecognized parameter
> -Xinject-code"
Is your JAR file in the XJC classpath?
Maybe you'll find this helpful:
https://hyperjaxb2.dev.java.net/nonav/hyperjaxb2/reference/reference.htm
l#d0e2237
And a general comment. I see you're trying to do a nice thing but I'd
suggest that you first take a look at build tools like Ant or Maven. You
are doing things manually. This is ok, but you can automate a lot and
avoid a lot of problems.
I'd suggest maven2, this seems to be the tool of the future. Therefore
the earlier you switch to it/learn it, the better is it for you.
Bye.
/lexi
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net