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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With