Issues with ant.jar


Quite new to gradle here. I’ve been tasked with migrating our build processes to gradle (instead of ant). I’ve come across a bug I just cannot find any documentation about.

The build.gradle is relatively simple: I simply ant.importBuild “buildGradle.xml” and call a bunch of task from said ant file (i’ve done it in many other project, worked fine).

After said tasks are done, I jar everything up with ant.jar (destfile) {source: }.
It’s at this point I encounter an issue i’ve never seen before: Could not find default manifest: /org/apache/tools/ant/

Documentation indicate a default manifest should be created if I don’t specify / create one (so… why the error?) creating a manifest doesn’T seem to help, adding the java plug-in lead to another error ( declaring custom ‘build’ task when using the standard Gradle lifecycle plugins is not allowed)

Looking for any help/clue. The structure of the projects are not really gradle-esque (as this is a transitory step, we do not want to modify anything required for the production build).

gradle script:

/** Configures the build script classpath for this project. */

buildscript {

repositories {

dependencies {
	classpath 'org.glassfish.metro:webservices-rt:2.3.1'
	classpath 'org.glassfish.metro:webservices-extra:2.3.1'
	classpath 'org.glassfish.metro:webservices-api:2.3.1'


task jar{

ant.importBuild 'buildGradle.xml'
dependsOn (list of ant task)

 ant.jar(destfile: 'libs/soandso.jar'){
 	fileset(dir: 'bin')
 	fileset(dir: 'build')


/** Encoding. */
tasks.withType(JavaCompile) {

options.encoding = 'UTF-8'


tasks.withType(Test) {

systemProperty 'file.encoding', 'UTF-8'