Ant tasks has wrong order


(Martin Bednář) #1

I want to use gradle for our legacy application. Our ant build file has about 600 targets… The idea is to use gradle that import old ant targets and run it without rewriting all the logic to the gradle and write new tasks in gradle script. The problem is that dependent ant tasks has wrong order when running under gradle.

I’m using this script:

configurations {
    antcp {
       description = 'ant classpath'
      transitive = true
      exclude module: 'ant'
    }
}
  dependencies {
    antcp 'xerces:xercesImpl:2.8.1'
    antcp 'ant-contrib:ant-contrib:1.0b2'
    antcp 'org.apache.ant:ant-junit:1.8.2'
}
  ClassLoader antClassLoader = org.apache.tools.ant.Project.class.classLoader
                 configurations.antcp.each { File f ->
                         antClassLoader.addURL(f.toURI().toURL())
                 }
   ant.importBuild 'build.xml'

Are there a way how to run dependent ant tasks in right order ?

Thank you Martin


(Peter Niederwieser) #2

Until recently, ‘ant.importBuild’ had a known limitation in that it didn’t support soft dependencies between Ant targets. However, this is fixed in (I believe) 1.10.


(Martin Bednář) #3

Checked with Gradle 1.10-rc-1 today with same results :frowning:


(Peter Niederwieser) #4

Perhaps it will only be in 1.11 then.