I've been wrestling with this for about a day now. I'm attempting to invoke a
build.xml file from a gradle script and the build.xml in question has a
taskdef for com.oopsconsultancy's XmlTask. The build.xml runs fine when
invoked via ant. Invoking from build.gradle fails because it cannot find the
class for XmlTask. My build.gradle:
configurations {
antcp {
description = 'ant classpath'
transitive = true
exclude module: 'ant'
}
}
dependencies {
antcp "ant-contrib:ant-contrib:1.0b3"
antcp "com.oopsconsultancy:xmltask:1.16"
}
task gradleDist << {
println "PATH: ${configurations.antcp.asPath}"
ant.taskdef resource: "net/sf/antcontrib/antcontrib.properties",
classpath: configurations.antcp.asPath
ant.taskdef(name: 'xmltask', classname:
'com.oopsconsultancy.xmltask.ant.XmlTask', classpath:
configurations.antcp.asPath)
ant.ant antfile: "build.xml", target: "dist", dir: "."
ant.ant antfile: "build.xml", target: "build-dist-artifact", dir: "."
}
When building, the ant path is printed as:
/home/builder/.gradle/caches/artifacts-4/ant-contrib/ant-contrib/76dd5c26956e9373dcceb581ac0cfb1c/jars/ant-contrib-1.0b3.jar:/home/builder/.gradle/caches/artifacts-4/com.oopsconsultancy/xmltask/76dd5c26956e9373dcceb581ac0cfb1c/jars/xmltask-1.16.jar
So I can see that xmltask is on my ant classpath but the build script fails
with the following error:
taskdef class com.oopsconsultancy.xmltask.ant.XmlTask cannot be found
using the classloader AntClassLoader[]
The build.xml has a taskdef for XmlTask like:
<taskdef name="xmltask"
classname="com.oopsconsultancy.xmltask.ant.XmlTask"/>
Not sure what I'm doing wrong.
--
View this message in context:
http://gradle.1045684.n5.nabble.com/Multi-project-Ant-build-and-XmlTask-tp5078402p5078402.html
Sent from the gradle-user mailing list archive at Nabble.com.