Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use jaxb plugin extensions with gradle-jaxb-plugin

I use gradle-jaxb-plugin to generate classes from an XSD: https://github.com/jacobono/gradle-jaxb-plugin

It works fine with external binding and I can use the built-in XJC extensions without a problem. But I did not manage jaxb extension plugins to work, in particular -Xinheritance from the jaxb2-basics.

When I try the configuration proposed in the gradle-jaxb-plugin documentation, I get the following error:

:pwa-application:xjc FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':pwa-application:xjc'.
> java.util.ServiceConfigurationError: com.sun.tools.xjc.Plugin: Provider org.jvnet.jaxb2_commons.plugin.jaxbindex.JaxbIndexPlugin not a subtype

I have found the explanation in this thread: com.sun.tools.xjc.Plugin: Provider <plugin> not a subtype but there is no solution for gradle-jaxb-plugin there, I got stuck.

like image 865
Boris Maizel Avatar asked Mar 15 '23 13:03

Boris Maizel


1 Answers

Well, I can now answer my question by myself.

The solution is simply to use

taskClassname      = "org.jvnet.jaxb2_commons.xjc.XJC2Task"

It is mentioned in the documentation, but there is no explanation. Now I know what it is for.

like image 144
Boris Maizel Avatar answered Mar 21 '23 16:03

Boris Maizel