xjc, maven-jaxb2-plugin: cryptic java.lang.NoSuchMethodException: javax.xml.bind.annotation.XmlElementRef.required()

浪尽此生 提交于 2019-12-05 10:23:28

Could you post your java -version or the beginning of the mvn -X log?

The problem is most probably here:

[INFO] Detected JAXB API version [2.1].
...
[INFO] specVersion:2.2
  • You'll probably need to update your JDK or
  • put jaxb-api-2.2.jar into your $JRE_HOME/lib/endorsed directory.
  • Alternatively you can put the JAXB API jar into a different folder and include it into the java.endorsed.dirs system property.

I see you're using now. If you want to stay on JAXB 2.1 with your JDK (which is probably somewhat outdated), you can:

  • configure <specVersion>2.1</specVersion>
  • or use the plugin artifact id maven-jaxb21-plugin, it is a variant of the plugin which is linked with JAXB 2.1.

Upgrading my JDK to the correct version (1.7, in this case) addressed this.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!