jstuyts <jst@...> writes:

> 
> 
> Luke Stephens wrote:
> > 
> > If I try to use:
> > 
> > class HibernateSchemaGenTask extends DefaultTask {
> >     schemaExport = new org.hibernate.tool.hbm2ddl.SchemaExport()
> > }
> > 
> 
> You need to define a method that will actually perform the action of the
> task:
> class GreetingTask extends DefaultTask {
>     @TaskAction
>     def greet() {
>         println 'hello from GreetingTask'
>     }
> }
> 
> See
> 
<http://www.gradle.org/current/docs/userguide/userguide_single.html#N1461F>
;
> for more information.
> 
> -----
> --
> Regards, Johan
> --
> View this message in context: http://gradle.1045684.n5.nabble.com/Gonna-Try-
This-Again-Hibernate-Classpath-and-SchemaGen-tp4661005p4661498.html
> Sent from the gradle-user mailing list archive at Nabble.com.
> 
> 


Hey,

My schemaExport task (that creates an SQL file, rather then directly adjusts 
the 
database) looks like this:

task schemaExport (dependsOn: compileJava) << {
    description='Exports the SQL needed to create the database schema'

    ant.taskdef(name: 'schemaexport', classname: 
'org.hibernate.tool.hbm2ddl.SchemaExportTask', classpath: 
configurations.tool.asPath)

    ant.schemaexport (properties: 'src/main/resources/hibernate.properties', 
quiet: 'no', text: 'yes', delimiter: ';', output: 'schema-export.sql') {
        fileset (dir: rootProject.projectDir, includes: 
'**/src/main/resources/**/*.hbm.xml')
    }
}

The "tool" configuration contains relevant dependencies, such as subprojects 
with hbm mapping files, and hibernate-core, which may or may not be present in 
the compile or runtime configuration of the current subproject.

I'm sure with a few adjustments to the ant task, you could get it to directly 
update the database instead of generating the SQL file.

Greets Rolf



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to