// tag::apply-plugin[]
plugins {
    id 'java-library'
}
// end::apply-plugin[]

// tag::import-build[]
ant.importBuild('build.xml') { String oldTargetName ->
    return oldTargetName == 'build' ? 'ant_build' : oldTargetName  // <1>
}
// end::import-build[]

// tag::source-sets[]
sourceSets {
    main {
        java {
            srcDirs = [ ant.properties['src.dir'] ]
            outputDir = file(ant.properties['classes.dir'])
        }
    }
}
// end::source-sets[]

// tag::task-dependencies[]
compileJava.dependsOn 'prepare'  // <1>
package.dependsOn = [ 'compileJava' ]  // <2>
assemble.dependsOn = [ 'package' ]  // <3>
// end::task-dependencies[]
