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

时间:2018-10-16 14:53:56

标签: gradle ant

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?

1 个答案:

答案 0 :(得分:0)

我找不到解决此问题的方法。 我将build.xml文件移到了gradle文件所在的目录中,并更改了构建文件中的目录引用。