Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump versions, remove workaround in XjcWorker #10

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ghost
Copy link

@ghost ghost commented Jun 4, 2020

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 to com.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 of com.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 uses com.sun.tools.xjc.Options from jaxb-xjc 2.3.2 (containing Util) and Spring enforced jaxb-runtime 2.3.3 (containing Utils). So double-check the exact versions on your classpath.

@ghost
Copy link
Author

ghost commented Jun 17, 2020

@bjornvester shameless bump

@rovangju
Copy link

Thanks for the patch - I got bit by this. Your search engine plan worked :)

@ghost
Copy link
Author

ghost commented Jun 19, 2020

@rovangju in case it helps, I published my fork to the Gradle plugins portal so I could use it at work (we have a corporate repository that proxies the plugins portal and our CI server uses only that repo).
See https://plugins.gradle.org/plugin/com.github.kad-leeuwg1.xjc for more details. Keep in mind that it's a fork, so I would advice to switch back to this plugin as soon as this pull request is merged.

lion7 added 2 commits August 31, 2020 12:59
* Move configuration to XJC task instead of the extension
* Allow multiple XJC tasks to be configured
* Automate the integration test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants