I have been using annox to add annotations on my jaxb-generated classes (through bindings files) but I can't find a way to add annotations directly on the package (package-info.java).
I've been trying to do something like this in my bindings.xml:
<jaxb:schemaBindings>
<jaxb:package name="my.package">
<annox:annotate>
<annox:annotate annox:class="my.Annotation" />
</annox:annotate>
</jaxb:package>
</jaxb:schemaBindings>
but jaxb complains that annox:annotate
is not expected to be there.
Is there another way to do it?
Author here.
This is not supported a the moment, but can be easily implemented. Please file an issue here: https://github.com/highsource/annox/issues
The way this will be done is using
@target="package"
. So you'll have to customize something in this package (a class, whatever) and set thetarget
attribute topackage
. The annotation will then go to thepackage-info.java
.UPDATE
This is implemented in JAXB2 Annotate Plugin 1.0.0.
https://github.com/highsource/jaxb2-annotate-plugin/issues/1
Example: