How to register custom types in gradle ant task

39 views
Skip to first unread message

cdalnxdr

unread,
Nov 3, 2016, 12:44:56 PM11/3/16
to Querydsl
Using:
task generateQueryDSLFromDB << {
    ant
.taskdef(name: 'generateQueryDSL',
           
classname: 'com.querydsl.sql.codegen.ant.AntMetaDataExporter',
           
classpath: configurations.compile.asPath)
    ant
.generateQueryDSL(
           
...
           
targetFolder: 'src/main/generated')
           
{
                typeMapping
(table: "tableName", column: "columnName", type: "package.ClassType")
           
}
}

Throws a ClassNotFoundException because no custom types are registered. 
I tried various methods for adding them to the ant task but with no success.
Please show me a code snippet to register custom type classes to the ant task.

Thanks

Daniel Balog

unread,
Nov 17, 2016, 4:50:43 AM11/17/16
to Querydsl
I'm having exactly the same problem. I think this is an oversight in the AntMetaDataExporter. I don't think it's possible to set an array of strings directly using an Ant Task.

If you look at "typeMappings", "numericMappings" or "renameMappings" you will see that these are handled using nested elements.

I believe the "customTypes" property in AntMetaDataExporter should also be written using nested elements. The current array of strings approach does not work.
Reply all
Reply to author
Forward
0 new messages