Reputation: 378
When I use jxb:class
with annox:annotate
, I get this exception:
com.sun.istack.SAXParseException2; systemId: file:/usr/workspace/project/package/file.xjb; lineNumber: 16; columnNumber: 35; the compiler failed to honor this customization annox: annotate. He was attached to an incorrect location or is inconsistent with other binds.
at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:86)
at com.sun.tools.xjc.model.Model.generateCode(Model.java:310)
at com.sun.tools.xjc.Driver.run(Driver.java:363)
at org.codehaus.mojo.jaxb2.AbstractXjcMojo.execute(AbstractXjcMojo.java:316)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
I used this configuration:
<jxb:bindings node="xs:complexType[@name='MyType']//xs:element[@name='property']">
<jxb:class ref="org.project.model.MyType" />
</jxb:bindings>
Upvotes: 3
Views: 1446
Reputation: 43709
EDIT: I might have been wrong about my interpretation. I'll still leave the answer until we've got it cleared.
Author of maven-jaxb2-plugin and annox here.
It is quite obvious that it won't work.
This:
<jxb:class ref="org.project.model.MyType" />
Instructs JAXB to use a presumably existing class org.project.model.MyType
instead of generating a new on. So there's no class generated, so jaxb2-annotate-plugin has nothing to add annotations to.
I hope it is clear, why you can't add annotations to the already existing classes. :) That would be too much to ask. You can only add annotations to the generated classes.
Upvotes: 1