hibernategradle-plugingradle-dependencies

Hibernate gradle plugin: HibernateEnhance task cannot resolve compileOnly dependecies


I tried to update the existing hibernate Gradle plugin from 5.6.9.Final to 6.1.0.Final like this:

Old configuration:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.hibernate:hibernate-gradle-plugin:5.6.9.Final'
    }
}

apply plugin: 'org.hibernate.orm'

repositories {
    mavenCentral()
}

hibernate {
    enhance {
        enableLazyInitialization = true
        enableDirtyTracking = true
    }
}

New configuration:

plugins {
    id 'org.hibernate.orm' version '6.1.0.Final'
}

repositories {
    mavenCentral()
}

hibernate {
    enhancement {
        lazyInitialization = true
        dirtyTracking = true
    }
}

The new version, also added 3 Gradle tasks:

The last task fails, if I use some compileOnly dependecies like:

dependencies {
    compileOnly 'javax.servlet:javax.servlet-api:4.0.1'
}

I tried to use implementation instead of compileOnly, but this didn't help.

How can I make it work?

This is the reproducer: https://github.com/stefan-dan/hibernate_enhance_plugin


Solution

  • It was an issue from the Hibernate.

    They have fixed it in version 6.1.5.Final.