tldr; How can I use parallel project execution with a JAXB/XJC plugin?
My team is migrating our build from Maven to Gradle. We have been able to find a suitable plugin for everything we were doing in the previous build. One of the features that swayed us to finally move was the parallel project execution incubating feature. This worked great!!! …until we added in our JAXB/XJC portions of the build.
The gradle-jaxb-plugin worked ok, but it didn’t provide support for current default/best practice builds as it made some assumptions about the project layout rather than using the projects configuration. We forked it, updated it, submitted PR’s, and ultimately ended up publishing our own build. This is publicly accessible and here is an example showing some of the newly added features.
The one thing we can’t get to work is the parallel project execution. The XJC itself is not thread-safe. We haven’t exactly figured out why this is, but it obviously is using some shared space in a non-locking manner as the final code it generates is just mangled and inconsistent.
I found this thread, which referenced this thread, and ultimately this non-merged/closed PR. I will assume this sequence is rather out of date at this point since it is over 2 years old (Aug 2013 through Feb 2014). I also found this thread, but it acknowledges that there are potentially still some concurrency issues.
Since we are already updating the plugin, what do we need to add/do in order to use parallel project execution with the JAXB XJC?
How do we synchronize the execution of that task across the entire multi-project build?
The non-thread-safe nature of the XJC is causing our concurrency issue, I’m just trying to find the work around so we can gain the benefits of parallel builds.
NOTE: These were originally inline links in the text, but as a new user I could only put in 5 links. So here they are in non-link format.
1 - github.com/jacobono/gradle-jaxb-plugin
2 - github.com/rackerlabs/gradle-jaxb-plugin