# Converting an Ant task definition to Gradle

**URL:** <https://discuss.gradle.org/t/converting-an-ant-task-definition-to-gradle/3327>\
**Category:** Old Forum Archive\
**Created:** [June 5, 2012, 2:44am UTC](https://discuss.gradle.org/t/converting-an-ant-task-definition-to-gradle/3327 "2012-06-05T02:44:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CouldBeAnother](https://avatars.discourse-cdn.com/v4/letter/c/b5a626/32.png) [@CouldBeAnother](https://discuss.gradle.org/u/CouldBeAnother)\
**Post date:** [June 5, 2012, 2:44am UTC](https://discuss.gradle.org/t/converting-an-ant-task-definition-to-gradle/3327/1 "2012-06-05T02:44:00Z")

</div>

I’m a Gradle n00b. I have been asked to convert an ages-old Ant build script to utilise Gradle instead.

My first task is related to an Ant task which creates a i18n properties file as part of the build. The task creates a new task definition which subsequently gets called by the build process (as it’s one of the tasks that the build target depends upon). It looks like this:

```gradle
<target name="prepare-i18n" depends="ivy-retrieve" >
        <ivy:cachepath organisation="i18nlog" module="i18nlog" revision="1.0.9" inline="true" conf="default" pathid="i18nlog-classpath"/>
        <taskdef name="i18n" classpathref="i18nlog-classpath" classname="mazz.i18n.ant.I18NAntTask" />
</target>

```

mazz.i18n.ant.I18NAntTask is part of a jar included in the project’s classpath called “i18nlog-1.0.9”.

I cannot just import the Ant build file into my Gradle script as there are lots of task name clashes (e.g. “test”, “compile”) so I need to rewrite this task from scratch. I _think_ I can include the jar within the Gradle task’s classpath, but I cannot find any information showing how to call the class contained therein. Is it possible?

Thanks.

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [June 11, 2012, 6:43pm UTC](https://discuss.gradle.org/t/converting-an-ant-task-definition-to-gradle/3327/2 "2012-06-11T18:43:00Z")

</div>

There’s a section in the userguide on [using custom ant tasks](http://gradle.org/docs/current/userguide/ant.html#N1155E).
