we had an ClassNotFoundException happening after executing XJC Ant task through Gradle. And we managed to find the root cause for this and it’s in the JAXB implementation. That implementation closes ClassLoader (ant-loader) from Gradle and prevents from loading new classes.
Issue for that is opened: https://github.com/eclipse-ee4j/jaxb-ri/issues/1391
I’m writing this here just in case somebody from the community has the same issue and to save them the trouble of debugging ClassLoaders.
Small repository with failing example, fix and more detailed description is created here: https://github.com/aspevec/xjc_ant_gradle