davidmoten / davidmoten/jax-maven-plugin

Plugin with bindings

Open
#13 6 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Java
Stars
35
Forks
12
PR merge metrics
No merged PRs in 30d

Description

Hi!
I sucessfully use the plugin in the 99% of my use cases; but now I've problem with JAXB bindings.

I've an xsd and a xjb file that contains some bindings to customize the building of the generating JAXB; in particular, I've to add the annotation @XmlElement(name = "test") to force some elements to have a specific name (e.g."test") and not the default used (the name of the property).

This is my xjb (sorry for the bad format):

@javax.xml.bind.annotation.XmlElement(name="MessageID")

The maven plugin is configured in follow way:
[...]

-verbose
-extension
-d
${project.build.directory}/generated-sources/jaxb
-p
com.test.jaxb
**-b
${basedir}/src/main/resources/xsd/bindings/jaxb-bindings.xjb.txt**
-xmlschema
${basedir}/src/main/resources/xsd/original.xsd

[...]

The compilation/build fails due this error:

[ERROR] Unsupported binding namespace "http://annox.dev.java.net". Perhaps you meant "http://java.sun.com/xml/ns/jaxb/xjc"?
line 2 of file:/{path}original.xsd

Reading on the web, I've found that we can use the argument -Xannotate (see here: [https://stackoverflow.com/questions/46807693/jaxb-change-the-element-name-of-xmlelements-annotation](https://stackoverflow.com/questions/46807693/jaxb-change-the-element-name-of-xmlelements-annotation) ). But if I add this argument to your plugin, it doesn't work because it doesn't recognize the -Xannotate param:

[...]
"
-verbose
-extension
**-Xannotation**
-d
${project.build.directory}/generated-sources/jaxb
-p
com.test.jaxb
**-b
${basedir}/src/main/resources/xsd/bindings/jaxb-bindings.xjb.txt**
-xmlschema
${basedir}/src/main/resources/xsd/original.xsd
"

[...]

Exception in thread "main" com.sun.tools.xjc.BadCommandLineException: unrecognized parameter -Xannotation
at com.sun.tools.xjc.Options.parseArguments(Options.java:830)
at com.sun.tools.xjc.Driver.run(Driver.java:231)
at com.sun.tools.xjc.Driver.run(Driver.java:191)
at com.github.davidmoten.jaxws.XjcMain.main(XjcMain.java:8)

Do you have any suggestions?

Thx and, again, compliments for the excellent plugin.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.