Skip to content

Instantly share code, notes, and snippets.

@raymyers
Created December 10, 2010 04:30
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save raymyers/735788 to your computer and use it in GitHub Desktop.
Save raymyers/735788 to your computer and use it in GitHub Desktop.
Example of calling Gradle from Ant
<project name="gradle-wrapper" default="" basedir=".">
<description>
</description>
<!-- set global properties for this build -->
<property environment="env" />
<property name="gradle.executable" location="${env.GRADLE_HOME}/bin/gradle" />
<target name="jar">
<exec executable="${gradle.executable}" dir=".">
<arg value="jar" />
</exec>
</target>
<target name="dist">
<exec executable="${gradle.executable}" dir=".">
<arg value="dist" />
</exec>
</target>
<target name="clean">
<exec executable="${gradle.executable}" dir=".">
<arg value="clean" />
</exec>
</target>
<target name="test">
<exec executable="${gradle.executable}" dir=".">
<arg value="test" />
</exec>
</target>
<target name="eclipse">
<exec executable="${gradle.executable}" dir=".">
<arg value="eclipse" />
</exec>
</target>
</project>
@douglascayers
Copy link

Thanks! Just what I was looking for today. I've updated the "gradle.executable" to handle windows and linux runtime environments (some of our developers are on windows but then we deploy to linux servers).

https://gist.github.com/DouglasCAyers/6637662

<property environment="env" />

<condition property="gradle.executable" value="${env.GRADLE_HOME}/bin/gradle.bat" else="${env.GRADLE_HOME}/bin/gradle">
    <os family="windows" />
</condition>

@ljaljushkin
Copy link

Thanks a lot! Was very helpful for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment