'using maven deployit plugin which relies on jaxb with java 11

We just migrated our project to java 11. We configured new dependencies in the pom for the jaxb &co packages that were present in jdk-8 but were removed in jdk-11.

What we did not expect was for the deployit plugin to fail doing its job with an ugly error repeated 7 times for various classes of the same package.

NoClassDefFoundError: Unable to load builtin provider: org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlSeeAlsoProvider

It was not a very big surprise. Actually, the dependencies we declared for jaxb and its kind in the pom were to make so that the required libraries would be included in the application package since they are no more available in the JDK. But deploy-it has its own dependencies. No the trick is how to tell it to depend on jaxb?

I considered several options:

  1. adding the dependency in the dependencies section of the plugin, but not sure it would be taken if it does not override a dependency of its pom.
  2. upgrading the plugin to a more recent version (it changed its name to xldeploy some years ago BTW), but system requirements are still jdk-8 with 6.0.
  3. add arguments to the jvm to try something like using --add-modules java.xml.bind as documented here, but the plugin does not seem to accept an <argLine> section in its configuration

I thoroughly searched the web for how to configuring dependencies for maven plugin and even on that topic, did not found much information. At most I found out about goal dependency:resolve-plugins that gives you in theory the dependency tree of your plugins but does not seem to work much for deployit

Anyway I have the feeling that my problem might not be very uncommon, so maybe I am googling the wrong keywords. Anybody has a hint on the matter?



Solution 1:[1]

The solution to this problem was to use maven toolchain plugin for compiling in JDK11 while still running Maven with the JDK 8.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aldian