Hi guys, I’m just getting started with Gradle, so apologies if my question is a bit basic. I’m working on a task of migrating our build system to Gradle from Ant. I want to take it incrementally so I’ll always have a gradle build working. This was one of the main reasons why we chose Gradle over Maven among others.
To begin with, I created a simple build.gradle file with just this line:
# build.gradle:
ant.importBuild 'build.xml'
But when I tried running one of the simple targets in build.xml via gradle, I got this error:
$ gradle clean
[ant:taskdef] Could not load definitions from resource net/sf/antcontrib/antcontrib.properties. It could not be found.
[ant:taskdef] Could not load definitions from resource net/sf/antcontrib/antcontrib.properties. It could not be found.
[ant:taskdef] Could not load definitions from resource org/jacoco/ant/antlib.xml. It could not be found.
:clean
BUILD SUCCESSFUL
Total time: 4.145 secs
The ant target “clean” is actually imported in to ‘build.xml’ from another build file called ‘build_helper.xml’, so this tells me nested importing went well, otherwise Gradle wouldn’t have been able to invoke this target. But it couldn’t find antcontrib.properties and antlib.xml which are in my ‘$ANT_HOME/lib’.
This brings the question whether the dependencies have to be mentioned in build.gradle file. Or did it not work here because the jar files of these tasks are outside of the project directory? If it’s the later case, is there a way to tell Gradle to add ‘$ANT_HOME/lib’ to the classpath?