Search code examples
gradleant

Adding a path to build.xml when importing an Ant build into Gradle


I need to import an Ant build file into my build.gradle file. However, I have a multi-project build. My gradle files for each project are in their own directory. But I would like to keep the build.xml file in the main directory but it cannot import the build file when it is not in the same directory as the gradle file.

So, when the build file and gradle file is in the same directory, I can import the Ant build file using this gradle command:

ant.importBuild 'build.xml'

But when I put the build file in the main directory (1 level above the gradle file) and try to import the build file using this command

ant.importBuild '../build.xml'

I get the error Could not import Ant build file 'C:<correct directory path>\build.xml'.

The path the error displays is the correct path. But it cannot import the file. Is this my design? Does the Ant build file have to be in the same directory as the gradle file?


Solution

  • I could not find a solution to this issue. I moved the build.xml file into the same directory as the gradle file and changed the directory references in the build file.