Can I import existing Ant builds into a Gradle build?


(Gradle FAQ Bot) #1

While migrating to Gradle, I’d like to reuse parts of my existing ant build from Gradle.

How can I do this?


(Luke Daley) #2

Gradle can import any Ant build script. Gradle integrates deeply with an Ant build. Every Ant target is represented as a Grade task. This task can be further enhanced in your Gradle build script.

The integration even works in both ways. You can depend on Gradle tasks in your build.xml. In addition, accessing and modifying Ant properties from your build script is now much easier.

See this section of the user guide for details.


(Scott Taylor) #3

I’m having one issue migrating one of my ant tasks to gradle. My ant target (xslt) sets the style properties to “${ant.home}/etc/changelog.xsl”. The ant.home property doesn’t seem to be available when running from gradle. Does gradle include the xsl stylesheets that come with ant? If so how can I refer to them? If not, any recommendations where these type of files should be placed in a gradle project?


(Peter Niederwieser) #4

Please create a new topic with an appropriate title.


(Scott Taylor) #5

Done. See http://forums.gradle.org/gradle/topics/how_can_i_refer_to_ants_built_in_stylesheets_when_migrating_to_gradle