users@jaxb.java.net

Re: Using annox to generate annotations: works for me in only limited case

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Tue, 22 Sep 2009 09:15:19 +0200

Hi,

> I grabbed your example (yes, I had looked at the examples already there) and
> tried it in my dev environment.
> Oddly it failed to recognise the -Xannotate switch until I added hyperjaxb
> to the path (which I want to do anyway).

You don't need Hyperjaxb3, you only need jaxb2-basics-annote
dependencies on your classpath.

> So with some more confidence I went back to my own example and tried it
> again. I happened to add both fields to the MyAnnotation so it became:
>
> <MyAnnotation myName="xxx" myField="yyy"
> xmlns="http://annox.dev.java.net/nz.co.senanque"/>
>
> and I changed my annotate interface accordingly.
>
> And that just worked. Generated the right code and all. No problems.
>
> So what I was doing wrong earlier was I was not specifying all of the
> arguments for the annotation. The error I got had limited information:
>
> [ERROR] Error parsing annotation.
> line 50 of file:/home/roger/workspace/HyperJaxbSandbox/sandbox.xsd
>
> The line number is correct.

Try building with mvn -X, this might give more information.

> Your samples have optional arguments, ie you obviously don't get an error
> when you leave an argument off. But I do, incl on your samples. So I need to
> upgrade to the latest I guess. I'll do that next.

> In case it's relevant (should have said this before):
> jaxb 2.1.12
> jaxb2_commons_* 0.2.GA

Quite old. Current development version is 0.5.2-SNAPSHOT, so it's been a while.

Bye,
/lexi