Bump versions, remove workaround in XjcWorker #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updated the jaxb-xjc to version 2.3.3. According to this commit message it should improve compatibility with Java 11+. For example JPMS module descriptors are added. It also contains the merged PR of @bjornvester which fixes the file leak issue. So I also removed the workaround in
com.github.bjornvester.xjc.XjcWorker
.Note that in JAXB RI 2.3.3 the class
com.sun.xml.bind.Util
is renamed tocom.sun.xml.bind.Utils
in this commit. This can be a breaking change in some cases.I'm writing my specific issue here so people can (hopefully) find it via search engines so they won't have to spend hours debugging 😄
In my case I generated a fresh project with https://start.spring.io/.
After adding this
xjc-gradle-plugin
my build broke with a vague error:ERROR: Unable to load class 'com.sun.xml.bind.Util'
.After some digging I figured that Spring's dependency management enforces the latest JAXB RI 2.3.3, which causes weird classpath issues. In this case the class
com.github.bjornvester.xjc.XjcWorker
makes use ofcom.sun.tools.xjc.Options
, which in turn contains the following line:private static final Logger logger = com.sun.xml.bind.Util.getClassLogger();
.This results in a
ClassNotFoundException
being thrown because thexjc-gradle-plugin
usescom.sun.tools.xjc.Options
from jaxb-xjc 2.3.2 (containingUtil
) and Spring enforced jaxb-runtime 2.3.3 (containingUtils
). So double-check the exact versions on your classpath.