Hi,
I’m trying to use xdoclet-hibernate to generate some classes and I just can’t seem to figure now to make it work. From the documentation it looks like this should be easy. This is the example given in 14.1.1:
task check << {
ant.taskdef(resource: 'checkstyletask.properties') {
classpath {
fileset(dir: 'libs', include: '*.jar')
}
}
ant.checkstyle(config: 'checkstyle.xml') {
fileset(dir: 'src')
}
}
Now, they’ve actually used a fileset and I’ve tried that but it doesn’t work (I’ve tried tons of other things as well… Here’s what I have at the moment which fails telling me that fileset doesn’t support the include “attribute.”
ant.path(id: 'xdoclet.task.classpath') {
fileset( dir: 'libs', include: '*.jar' )
}
task genHibernateClasses
{
ant.echo(message:'Generating Hibernate Classes')
ant.taskdef(
name: 'xdoclet',
classname: 'org.xdoclet.ant.XDocletTask',
classpath: 'xdoclet.task.classpath'
)
ant.xdoclet(
destDir: '${buildDir}/classes',
fileset( dir: 'src/main/java', include: '**/bl/data/dataObjects/**/*.java' )
)
}
I’ve also tried this:
task genHibernateClasses
{
ant.echo(message:'Generating Hibernate Classes')
ant.taskdef(
name: 'xdoclet',
classname: 'org.xdoclet.ant.XDocletTask',
classpath {
fileset( dir: 'libs', include: '*.jar' )
}
)
ant.xdoclet(
destDir: '${buildDir}/classes',
fileset( dir: 'src/main/java', include: '**/bl/data/dataObjects/**/*.java' )
)
}
This fails with:
- What went wrong: A problem occurred evaluating root project ‘ib-business-logic’. > Could not find method classpath() for arguments [build_2kt3598fqgbh33a7l94b05pi0o$_run_closure4_closure9@c2754b78] on root project ‘ib-business-logic’.
So … Is the problem the way I’m calling taskdef? I’ve see it called this way in the documetation as well… Here’s an example for an ftp task that’s in the documentation in 29.3:
task ftp << {
ant {
taskdef(name: 'ftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath)
ftp(server: "ftp.apache.org", userid: "anonymous", password: "me@myorg.com") {
fileset(dir: "htdocs/manual")
}
}
}
There I see the taskdef ( blah )… At first blush I thought the problem was that i needed to essentially do:
ant.taskdef() {
name: blah
classpath {
fileset( dir: 'foo', include: 'bar'
}
}
But that also doesn’t work. I’m surprised that I haven’t found another implementation of this anywhere. I thought the hibernate project itself was now on gradle so I would’ve thought that they’d have examples for this.
Any help would be greatly, greatly appreciated… I may go so far as to write a plugin for it if I can just get past my initial need here. All the documentation I find online is for the maven-xdoclet2 plugin which makes it hard to find anything else.
/geir