Is it possible to add dependencies to ant tasks


(Philippe Chatalic) #1

Hi,

I’m new to Gradle and I’ve been struggling for a while to set-up a multi project configuration… yet without success.

  • one of the sub-project (sp1) is a java-library

  • a second sub-project (sp2) reuses an existing project which build system is described by
    an ant build.xml.
    This project generates a .jar file, by assembling various components, including some
    .jar files produced by sp1, that first have to be copied within the lib/ dir
    of sp2, before running the appropriate (ant) task.

From the Gradle documentation, I have understood :

  • that is is possible to declare dependencies between (sub) projects
  • that it is possible to import a build.xml so that ant tasks could be run from Gradle command line

My idea is thus to :

  • state that sp2 depends on sp1
  • create a copy task to copy files from the sp1 to sp2/lib
  • add a dependency to one of the ant task so that the copy task is executed before the ant task.

But I don’t understand how to add such a dependency to an existing ant task.
These are apparently managed in a different way with respect to ordinary Gradle tasks.

Any hint ?