rohitjoins February 2016

Gradle - hibernate tool not working

I'm trying to create a task to convert cfg to sql and I'm using hibernate 3.

My ant task for same looks like this -

ant {
    taskdef(name: 'hibernateTool',
    classname: 'org.hibernate.tool.ant.HibernateToolTask',
    classpath: configurations.hibernatetool.asPath
    hibernateTool(destdir: 'resources/b2c/hibernate/schema') {
    annotationconfiguration(configurationfile:      'resources/b2c/hibernate/hibernate.b2c.cfg.xml')
    hbm2ddl(export: true, outputfilename: 'db-b2c-update-ddl.sql')
    classpath {
        pathelement(path: 'classes')
        fileset(dir: '../intl_lib') {
        include(name: '*/.jar')

I have added the following dependencies for the same -

dependencies {
    hibernatetool group: 'org.hibernate', name: 'hibernate-tools', version: '3.2.4.GA'
    hibernatetool group: 'org.hibernate', name: 'hibernate-entitymanager', version: '3.6.10.Final'

Applied plugin -

plugin: id "" version "1.2.3"

Set configuration as -

configurations {

I'm getting the following error while running the task -

[ant:hibernateTool] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[ant:hibernateTool] SLF4J: Defaulting to no-operation (NOP) logger implementation
[ant:hibernateTool] SLF4J: See for further details.

Here is the stack trace for the same -

Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.lang.ClassLoader.loadClass(
... 165 more


Nathan February 2016

I am wondering if you have not pointed to the correct repository. If you check the Gradle Plugin Portal page for Hibernate the following build information is provided. I am not sure which Gradle version you are using so I will provide the "all" version build.


buildscript {
  repositories {
    maven {
      url ""
  dependencies {
    classpath ""

apply plugin: ""

This build will explicitly define not only the plugin but the repository to download the plugin from. Please try this method of applying the Hibernate plugin and see if your issue is resolved.

Post Status

Asked in February 2016
Viewed 3,223 times
Voted 6
Answered 1 times


Leave an answer