users@jaxb.java.net

RE: JAXB Plugin

From: <HeruMartinus.Salim_at_infineon.com>
Date: Fri, 10 Nov 2006 11:31:53 +0100

Sorry,

I found my problem.
The file
/META-INF/services/com.sun.tools.xjc.Plugin in jaxb-xjc.jar doesn't
contains the line
com.sun.tools.xjc.addon.code_injector.PluginImpl

When I add it, and some changes on the build.xml, it works.

Thanks a lot for the help, and for the blogs (of Hanson and Kohsuke)

Regards,
Heru

-----Original Message-----
From: Salim Heru Martinus (IFAG COM BTS MT SD)
Sent: Friday, November 10, 2006 11:04 AM
To: users_at_jaxb.dev.java.net
Subject: RE: RE: RE: Re: RE: JAXB Plugin

Here is the ant buildfile:

<project name="MyProject" basedir="." default = "xjcplugin">
    <description>
        simple example build file
    </description>

  <target name="xjcplugin">
          <taskdef name="xjc"
            classname="com.sun.tools.xjc.XJCTask">
                  <classpath>
                    <pathelement
path="C:\UserData\salimher\JAXB\jaxb-ri\lib\jaxb-xjc.jar"/>
                  </classpath>
        </taskdef>
        <xjc>
        <arg value="-Xinject-code"/>
        </xjc>
    
  </target>
 
</project>

And here is my error message:

Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: build.xml
Detected Java version: 1.5 in: C:\Program Files\Java\jdk1.5.0_08\jre
Detected OS: Windows 2000 parsing buildfile
C:\UserData\salimher\testJava\plugin\build.xml with URI = file
:///C:/UserData/salimher/testJava/plugin/build.xml
Project base dir set to: C:\UserData\salimher\testJava\plugin
Build sequence for target(s) `compilexjc' is [compilexjc] Complete build
sequence is [compilexjc, clean, ]

compilexjc:
      [xjc] build id of XJC is 2.0-b52-fcs
      [xjc] failure in the XJC task. Use the Ant -verbose switch for
more detail s

BUILD FAILED
C:\UserData\salimher\testJava\plugin\build.xml:18: unrecognized
parameter -Xinje ct-code
        at com.sun.tools.xjc.XJC2Task._doXJC(XJC2Task.java:409)
        at com.sun.tools.xjc.XJC2Task.doXJC(XJC2Task.java:397)
        at com.sun.tools.xjc.XJC2Task.execute(XJC2Task.java:332)
        at com.sun.tools.xjc.XJCTask.execute(XJCTask.java:67)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:40)
        at
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: com.sun.tools.xjc.BadCommandLineException: unrecognized
parameter -Xi nject-code
        at com.sun.tools.xjc.Options.parseArguments(Options.java:664)
        at com.sun.tools.xjc.XJC2Task._doXJC(XJC2Task.java:407)
        ... 15 more
--- Nested Exception ---
com.sun.tools.xjc.BadCommandLineException: unrecognized parameter
-Xinject-code
        at com.sun.tools.xjc.Options.parseArguments(Options.java:664)
        at com.sun.tools.xjc.XJC2Task._doXJC(XJC2Task.java:407)
        at com.sun.tools.xjc.XJC2Task.doXJC(XJC2Task.java:397)
        at com.sun.tools.xjc.XJC2Task.execute(XJC2Task.java:332)
        at com.sun.tools.xjc.XJCTask.execute(XJCTask.java:67)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:40)
        at
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

Total time: 0 seconds

Have any hints?
Regards,
Heru

-----Original Message-----
From: Salim Heru Martinus (IFAG COM BTS MT SD)
Sent: Friday, November 10, 2006 10:28 AM
To: users_at_jaxb.dev.java.net
Subject: RE: RE: Re: RE: JAXB Plugin

What I mean I don't understand. How to use the compiled Plugin (such as
"At_generator"), how to bind it with XJC, also when I have one, how to
compile it, where to put the classes of the plugin, and again, how to
use it.

Regards,
Heru

-----Original Message-----
From: Salim Heru Martinus (IFAG COM BTS MT SD)
Sent: Friday, November 10, 2006 10:20 AM
To: users_at_jaxb.dev.java.net
Subject: RE: Re: RE: JAXB Plugin

Hallo,

Thanks for the info.
But I think it's just almost the same as from kohsuke's blog.
I have looked to the samples. And found also die "At_generator",
"code_injector", etc.
First before try to create one, I would like to try to use those
existing plugin. And I couldn't find one. For example, as I read, I was
told to use the option "-Xinject-code" which come from the method
getOptionName(). But as I tried this option, It doesn't work.

After that I would like to try to create a simple plugin. But again, I
can't find how.

Thanks for your help.
Regards,
Heru

-----Original Message-----
From: Hanson Char [mailto:hanson.char_at_gmail.com]
Sent: Friday, November 10, 2006 5:43 AM
To: users_at_jaxb.dev.java.net
Subject: Re: RE: JAXB Plugin

http://hansonchar.blogspot.com/2006/01/how-to-write-jaxb2-plugin.html

On 11/9/06, HeruMartinus.Salim_at_infineon.com
<HeruMartinus.Salim_at_infineon.com> wrote:
> I've found these plugin, still don't know how to use these.
> I tried to call in console using
> xjc -p testpackage -Xinject-code schema.xsd
>
> But it still doesn't work.
> How to create plugin? And how to use it?
>
> -----Original Message-----
> From: Salim Heru Martinus (IFAG COM BTS MT SD)
> Sent: Thursday, November 09, 2006 2:18 PM
> To: users_at_jaxb.dev.java.net
> Subject: RE: JAXB Plugin
>
> Sorry I wrote it not so clear.
> I mean where can I download the jar files of library in the specified
> link?
>
> And how can I start to learn about creating plugin? Step by step?
> I've read the Blog of Kohsuke about this topic, but no reference where

> to go on. Examples are there, but no explanation about how to
> download, and the step of "compiling" etc.
>
> Regards,
> Heru
>
> -----Original Message-----
> From: Salim Heru Martinus (IFAG COM BTS MT SD)
> Sent: Thursday, November 09, 2006 12:57 PM
> To: users_at_jaxb.dev.java.net
> Subject: JAXB Plugin
>
> Hello,
>
> I've just now realized, using the JAXB-plugin is the solution of my
> problems (sorry for the slow understanding of mine...^^ ).
> Could anybody tell which package should I download to get the tools
> (for
> ex: code-inject) which is shown in this API:
> https://jaxb-architecture-document.dev.java.net/nonav/doc/?jaxb/packag
> e-
> summary.html
>
> Amd can anybody tell which place is the best to start to learn
> creating plugin?
>
> Thanks for all the helps.
>
> Regards,
> Heru
>