I am having a hard time figuring out how to convert some Groovy-based build code to Java when the Groovy code is using AntBuilder. Apparently y’all or Groovy weave extra capabilities into it.
Project.getAnt() returns a Gradle AntBuilder that extends the Groovy AntBuilder. You’ll want to use the invoke( "xjc", args ) method of the AntBuilder. I believe args should be a Map containing the same KVs you have in your groovy code, but I’m not 100% sure of that.
I have internal code that calls xjc from Java as well. I haven’t looked at in a while, but if the groovy code has a closure at the end where your ... starts, you end up wanting a List. The first element of the list is the Map mentioned, and the second is your code that represents what would be in the closure.