Toolchains support for AntBuilder?

I have found the toolchains very helpful when working with newer releases of Eclipse (which require a minimum of Java 11) and builds that must still use Java 8. One of the builds I work with features the use of an Ant task and unfortunately this gets run with Java 11, which is the JDK that I use to run the build, and fails (because the underlying task is not ready for Java 8 yet). The documentation does not offer an example of a way to specify a custom toolchain for AntBuilder. Is there a way I can use toolchains to wire up Java 8 for running the Ant task? If not, are there any plans (or even objections) to add support for toolchains in AntBuilder?

Disclaimer: I’m not an Eclipse user and will never be

But I can quote a FAQ entry for you untested: buildship/Faq.md at master · eclipse/buildship · GitHub

By default, Buildship uses whatever Java runtime you started Eclipse with. If that runtime is only a JRE, then no compiler is available. We recommend you specify your Java home in the ~/.gradle/gradle.properties file, using the org.gradle.java.home property. This property will be honored both when running from Eclipse and when running from the command line.

And regarding the actual question, afair the AntBuilder is running Ant stuff in-process, so it might need significant amount of redesign to use it in a different process, but you are welcome to post a feature request on GitHub. :slight_smile:

As another work-around you might be able to use the worker api with process isolation, then you can use the fork options to set an executable from a toolchain and in the worker action you could use the Groovy built-in AntBuilder instead of the Gradle AntBuilder which unfortunately is not yet usable in worker actions: Provide a public equivalent for IsolatedAntBuilder · Issue #1157 · gradle/gradle · GitHub