Best way to consume ant tasks built in subproject

Hi,

I’m recently trying to convert an old project from Ant to Gradle (6.5).
That project built and then used some ant tasks into a jar file that I’d like to reuse.
I’ve then set up the subproject that builds the jar but I’m puzzled on how to best configure the projects that need to use that jar.

What I’ve done for now, is to create a configuration in the consuming subproject, like this:

configurations { antTasks }
dependencies { antTasks project('<project_path>') }

Then I create a normal task and use the ant method to call/define the ant tasks, passing a classpath such as configurations.antTasks.asPath().
This kind of works but leads me to the issue of dependencies not being automatically computed - I need to set manually that the task executing Ant depends on the jar task from the other subproject.

Is there a better way to do this?