Import Ant-build into Gradle Task

318 Views Asked by At

I am working on migration on Ant to Gradle. Currently I have 2 build.xml files which created 2 different .ear files. Instance buildA.xml is depends on buildB.xml and I need to build BuildB.xml separately. I only have one build.gradle and I tried importing 2 build using ant.importBuild 'A.xml' ant.importBuild 'B.xml' So, I am not not able to build the buildB.xml and even I do its getting the same set of JARs as BuildA. Should I create anoth build.gradle to make it separate?? Please give me suggestions if you have any idea. FYI- buildA is subset of buildB

Thanks in Advance :)

1

There are 1 best solutions below

0
Strelok On BEST ANSWER

If you have naming collisions of ant target names in the ant build files you can import them with a “transformer” closure:

ant.importBuild('buildA.xml') { antTargetName ->
    'a-' + antTargetName
}

ant.importBuild('buildB.xml') { antTargetName ->
    'b-' + antTargetName
}