I have a custom Ant task in my codebase that I need to use from Gradle. There are plenty of examples of how to use a task that is packaged in a jar file, but this is different.
My taskdef
should look something like:
ant.taskdef(
name: 'generator',
classname: 'MyGenerator',
classpath: ???
)
The classpath
should include everything in bin/
(where my code gets compiled to) and all the jars listed in the dependencies
section of the build script. How to fill in the blank?
I've tried a few different things, resulting in either obscure messages like The <taskdef> type doesn't support nested text data
or typical NoClassDefFoundError
.
I think what you want to do is described in the user guide under 'Using custom Ant tasks in your build'
basically you want to declare a configuration
, add dependencies to it in the dependencies
section and then use asPath
in your taskdef classpath
As Perryn Fowler wrote, you should declare a configuration
and dependencies
section. Here is an example I found: https://github.com/openbakery/gradle-common-plugins/blob/master/webdav.gradle
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.